402809: GYM100886 D Catenary
Description
Everyone has seen something like this a lot of times:
Suppose that you have several rods connected by their ends in a line in a certain order. The connections are non-stretchable and flexible, that is, each two successive rods can join at any angle. The rods are very thin, so they can be treated as line segments. The mass is uniformly distributed along each segment. Moreover, all the segments have the same density, so their masses are proportional to their lengths.
The first line contains two integers n and L (3 ≤ n ≤ 10, 200 ≤ L ≤ 299). The second line contains n integers l1, l2, ..., ln (100 ≤ li ≤ 199), the lengths of the segments from left to right. It is not allowed to change the order of the segments.
OutputOutput n - 1 lines. Each line must contain two real numbers, presenting x and y-coordinates of the points of the polyline from left to right. Do not output the first and the last points (0, 0) and (L, 0).
Please print the numbers with at least three digits after the decimal point.
ExamplesInput3 200Output
100 100 100
50.0000000000 86.6025403784Input
150.0000000000 86.6025403784
3 241Output
128 105 108
76.2967704600 102.7754971643
180.4447346423 89.4262815813