There is a polygon A1A2
AN (the vertices
Ai are numbered in clockwise order). On each side AiAi+1 an isosceles triangle AiMiAi+1 is built on the outer side of the polygon (MiAi = MiAi+1). The angle AiMiAi+1 is equal to αi. Here we assume that AN+1 = A1.
The set of angles αi satisfies a condition that the sum of angles in any of its nonempty subsets is not aliquot to 360 degrees.
You are given N, coordinates of vertices Mi and angles αi (measured in degrees). Write a program, which restores coordinates of the polygon vertices.
The first line contains an integer N (3 ≤ N ≤ 50). The next N lines contain pairs of real numbers xi, yi which are coordinates of points Mi (–100 ≤ xi, yi ≤ 100). And the last N lines of the input consist of degree values of angles αi. All real numbers in the input contain at most 2 digits after decimal point.
Output N lines with points coordinates, i-th line should contain the coordinates of Ai. Coordinates must be accurate to 2 digits after decimal point. You may assume that solution always exists.
Problem Author: Dmitry Filimonenkov
Problem Source: Ural State University collegiate programming contest (25.03.2000)