Mountain Biking

For each segment top, starting from rest, accumulate slope acceleration to compute the arrival speed at the foot.

Easy2MathSimulationNo attempts yetTime limit1sMemory limit256 MB

Problem

Mount Snowdon, the tallest place in Wales, draws mountain bikers from far and wide. A new business plans to open bike repair shops around the foothills to take advantage of the sport's popularity.

The owner's income depends on how fast the average biker is moving. The faster a biker reaches the foot of the hill, the more likely they run into trouble and have to walk, or limp, into a shop.

Snowdon has a very angular shape. Its profile is NN connected line segments pointing downward at various angles, and each segment starts where the previous one ended. From that description of the mountain, find the speed a biker reaches at the foot of the hill when starting from the top of any of the NN segments.

On a slope at θ\theta degrees from the vertical, a biker accelerates along the slope at exactly gcosθg \cos\theta m/s². The biker starts from rest and keeps the speed already gained when the slope changes.

Input

The first line contains an integer NN (1N41 \le N \le 4), the number of line segments making up the mountain, and a real number gg (1g1001 \le g \le 100), the coefficient of acceleration due to gravity, separated by a space.

Each of the next NN lines contains two integers DiD_i and θi\theta_i (1Di1041 \le D_i \le 10^4, 1θi891 \le \theta_i \le 89): the sloped length of the segment in metres, and the absolute angle of that segment from the vertical in degrees. The segments are given from the top of the hill to its bottom.

Output

Print NN lines. Line ii holds the speed of a biker who starts at the top of the ii-th segment from the top and finishes at the foot of the mountain, rounded to exactly six digits after the decimal point.