Happy Trails

Given trail sections as angles and distances, compute the total elevation change and print it rounded to two decimals.

Easy2MathImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

Working as a forest ranger comes with many duties, and one of the hardest is planning and preparing new trails for hikers. When a new trail opens to the public, the National Forest Service adds a page for it to their website. The page lists the location where the trail begins, the difficulty of hiking the trail, and pictures taken from the scenic viewpoints along the way. The hardest piece of data to gather is the difference in elevation between the start of the trail and the end of the trail.

You and your team use surveying equipment to measure the slope and the distance (along the trail) of each section. For example, a trail may begin completely flat for 500 meters, then switch to an 8 degree incline for 1000 meters, and then switch to a 2 degree decline for the final 500 meters. So many new trails are opening that computing the elevation difference by hand from the section descriptions has become too tedious, so you decided to write a program that does it for you.

Input

The first line contains a positive integer nn (n100n \le 100), the number of trail sections.

Each of the following nn lines describes one section, in order from the beginning of the trail to the end. A section is given as two integers aa and dd (50a50-50 \le a \le 50, 1d100001 \le d \le 10000). Here aa is the angle of elevation of that section in degrees, and dd is its distance in meters measured along the trail.

Output

Print the difference in elevation between the start of the trail and the end of the trail, in meters, on one line. The difference in elevation is always greater than 0 meters.

Round the answer to the hundredths place and always print exactly two digits after the decimal point. Keep the leading 0 for an answer between 0 and 1.