시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 3 1 1 33.333%

문제

The sides of a right-angled field of size 47*73 centimeters are labeled using letters A,R,Z,D. A small ball B (its size can be ignored) is placed inside this field 13 centimeters away from the side R and 29 centimeters from the side D (see pic.3). A player places his cue on the side R at a point that is located k centimeters from the side D and straightly hits the ball B. The ball continues its movements in a straight line and, if necessary, hits the sides of the field. The deflection occurs according to the laws of physics, that is, in directions making equal angles with a line perpendicular to the reflecting side. The starting fragment of the movement of the ball is shown in pic.4.

Your task is to write a program that for the given integer numbers k(0 ≤ k ≤ 73) un n(0 ≤ n < 109) would output the distance of the ball to the side R(BR) and side D (BD) after the ball has moved exactly n centimeters. The values BR and BD must be output as real numbers rounded to the nearest one thousandth of a centimeter.

Pic. 3

Pic. 4

예제 입력 1

29 100

예제 출력 1

19.000 29.000

예제 입력 2

16 20

예제 출력 2

27.142 43.142