시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB83262151.220%

문제

Joao wants to jon the robotic football team of his university. However, since he knows little about robotics and mathematics, he decided to build a 2-dimensional robotic arm to bootstrap his knowledge. 

The robotic arm is composed of N segments of various lengths. The segments can form any angle between them, including configurations that make it appear to self-intersect when viewed from above. The robotic arm works great, but it is not trivial to position the arm's tip as close as possible to given x, y target coordinates with so many joints to control. Can you help Joao?

Given the robotic arm description and target coordinates relative to the arm's origin, calculate a configuration that places the arm's tip as close as possible to the target. 

입력

The first line contains N, the number of segments composing the robotic arm. N lines follow, each with an integer Li describing the length of the ith segment from the fixed point until the arm's tip. There is one more line with 2 integers: the x, y coordinates of the target point to reach.

출력

The output should contain N lines, each containing two real numbers xi, yi indicationg the coordinates of the tip of the ith segment.

The length of the ith segment computed from the solution and input Li may not differ by more than 0.01. Similarly, the absolute error between the solution's distance to the target and the minimum possible distance to the target cannot exceed 0.01.

Note that, in general, there are many solutions. Your program may output any of them. 

제한

  • 1 ≤ N ≤ 20 Number of segments in the robotic arm
  • 1 ≤ Li ≤ 1000 Length of the ith segment
  • -20000 ≤ x,y ≤ 20000 Target coordinates to attempt to reach

예제 입력 1

3
5
3
4
5 3

예제 출력 1

4.114 -2.842
6.297 -0.784
5.000 3.000

예제 입력 2

2
4
2
-8 -3

예제 출력 2

-3.745 -1.404
-5.618 -2.107

힌트