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.
The first line of input, ~N~ ~(1 \le N \le 100)~, will consist of the number of vectors to be added.
The next ~N~ lines will consist of a magnitude, ~R~, and an angle in degrees, ~D~. You should note that angles may be greater than ~360~ degrees.
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 ~0~ and less than ~360~.
3 4 100 2 10 5 330