In M's class, Andrew is currently learning the chain rule (see Melanie's Theorem) for adding vectors. He's tried adding vectors tip-to-tail, but since he has no skill in math he's unable to do so. Your job is to create a program to add a series of vectors to help Andrew solve his physics problems.

You will be given vectors in the form of a magnitude and angle. Andrew's physics problems use angles in the standard unit circle convention (i.e. starting from the right hand side going counterclockwise), and all angles are positive. You may assume that the tail of the first vector is at the origin.

#### Input Specification

The first line of input, , will consist of the number of vectors to be added. The next lines will consist of a magnitude, , and an angle in degrees, . You should note that angles may be greater than degrees.

#### Output Specification

Your program should output the resultant vector's magnitude and angle, with a single space in between them. Both values should be rounded to the nearest whole number. Your angle must be greater or equal to and less than .

#### Sample Input

```
3
4 100
2 10
5 330
```

#### Sample Output

`6 18`

## Comments

There seems to be a lack of information on Melanie's theorem on the web. Notably, its Wikipedia page has been deleted. Could some information be provided on its use?

Thanks,

hob

It is irrelevant to the problem.

Does this problem require some next level vector graphing parabola humdinger in the hood?

It requires (relatively) elementary mathematical knowledge for a contest programmer. I guess in Ontario you would learn this in grade 10 but it's really not as difficult as you think.

Oh xD

Melanie's theorem was removed due to lack of sufficient sourcing. However, I assure you that it remains the best way to add relative vectors. In case you haven't heard of it, it is also known as the chain rule.