Limits 2s, 512 MB

Ekhlas is a bad boy, not the type of bad that you generally admire. When he was little, his primary goal was to grow up and kill all the people. Once he was suggested that by doing this, he will make a whole lot of enemies, and all of them will come to kill him from all around. Hearing this, he made a response that was truly exceptional. He said that in that case, he would kill people by turning and spinning! A truly brutal idea for a seven year old indeed!

Ekhlas's idea may sound horrible in real life, but this gives us an interesting idea for creating a game. Let's imagine a 2-dimensional game, where there is a gun at the origin ( 0 , 0 ). Initially, the gun is pointed towards the positive direction of the x-axis. Every second, a target appears at some point other than the origin. Your task is to move the gun towards the direction of that target and shoot it. You can turn the gun at any direction, but you can not change it's initial position. It should always be fixed to the origin. You can shoot a target if your gun is directly pointed towards that target.

You have to play this exciting game for N seconds, your job would be to minimize the total amount of degrees that you need to rotate your gun, while hitting all of these given targets. Remember that, a target must be processed in the order that they have appeared.

Input

The first line contains a positive integer N ( ≤ 1000 ), the total number of seconds you have to play the game. After that N lines follow. Each line will have two integers Xi and Yi ( -109 ≤ Xi,Yi ≤ 109 ). Xi and Yi will indicate the co-ordinate of the ith target. Both Xi and Yi will not be 0 at the same time.

Output

Output should be one real number, the minimum amount of rotations that your gun have to make in total in order to demolish all the targets sequentially. Errors less than 10-8 will be ignored.

Samples

InputOutput
3
5 5
7 7
55 55
45
InputOutput
1
0 120
90

Submit

Login to submit.

Statistics

29% Solution Ratio
HeroesNeverDieEarliest, Jan '17
Kuddus.6068Fastest, 0.0s
IamHotLightest, 131 kB
SIR.24Shortest, 626B
Toph uses cookies. By continuing you agree to our Cookie Policy.