PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000381. Đường chạy điền kinh (Athletics Track)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đường chạy điền kinh (Athletics Track)

Athletics Track

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

A stadium for the London Olympics needs a running track with perimeter exactly 400 metres. Its rectangular turf has length LL and width WW. The boundary consists of the two lengthwise sides and two circular arcs bulging outward from the widthwise sides. Both arcs belong to the same circle passing through the rectangle’s four vertices.

Given the ratio L:W=a:bL:W=a:b, determine LL and WW.

Track geometry

Input

One line contains two integers a,ba,b in the format a : b, separated by a colon.

Output

Print two real numbers L,WL,W in that order, separated by whitespace. The absolute error of each value must not exceed 10−510^{-5}.

Subtasks

  • Subtask 1 (20 points): 1≤a,b≤10001\le a,b\le1000; a=ba=b.
  • Subtask 2 (30 points): 1≤a,b≤10001\le a,b\le1000; a≥ba\ge b.
  • Subtask 3 (50 points): 1≤a,b≤10001\le a,b\le1000.

Examples

Input

3 : 2

Output

117.1858168913 78.1238779275

Explanation

The sides have ratio 3:23:2. At dimensions 3 and 2, the radius is 13/2\sqrt{13}/2 and each arc subtends 2arctan⁡(2/3)2\arctan(2/3). Scaling the entire figure to perimeter 400 gives a factor of about 39.06193939.061939. The two sides are 3 and 2 times this factor.

Input

5 : 4

Output

107.2909560477 85.8327648381

Explanation

For a reference rectangle with sides 5 and 4, the circle radius is 41/2\sqrt{41}/2 and each arc subtends 2arctan⁡(4/5)2\arctan(4/5). The perimeter is 10+241arctan⁡(4/5)10+2\sqrt{41}\arctan(4/5). Scaling both sides by 400 divided by this perimeter gives L≈107.2909560477L\approx107.2909560477 and W≈85.8327648381W\approx85.8327648381 metres.