Limits 1s, 128 MB

ICC world cup is a prestigious sports event for the cricketer and also for their fans. As a die hard fan of Bangladesh Cricket Team, you don’t miss a match for the world.

Today you went to see a match of your favorite team. As you look at the giant watch tower to see what time it is, you observe some unusual thing. There is a spider on the top of the edge of the second-hand of the clock. It was trying to get to the center of the clock. As the clock is broken like the nearest cricket board, when the second-hand of the clock points at 1212, it pauses there for SS seconds before beginning its full rotation. This continues for eternity. The spider is scared when the second-hand is rotating so, it doesn’t move. The Spider can only move when the second-hand of the clock stays still. Given the length of the second-hand of the clock N(meter)N (meter) and the freeze time of the second-hand of the clock is SS, can you calculate the total distance the spider covered to reach the center of the clock? You can assume that the second-hand of the clock always moves and only pauses for SS seconds when pointing at 12.

Note: Spider can move 1(meter)1 (meter) per second. You can assume that, you starts to calculate when the spider was at the edge and the second-hand of the clock was about to go for a full rotation.

PI=3.14159PI = 3.14159


The first and only line of the input contains two integers NN and SS— represents length of the second-hand of the clock (meter)(meter) and amount of time (seconds)(seconds) it stays still when point at 1212.

0N1000000 \leq N\le 100000

1S1000001\leq S \leq 100000


Output the total distance covered by the spider from the edge of the second-hand of the clock to the center.

Your answer will be accepted if the absolute or relative error does not exceed 10810^{-8}. Formally, let your answer be xx, and the jury's answer be yy. Your answer is considered correct if xymax(1,y)108\frac{|x-y|}{max(1,|y|)}\le 10^{-8}


5 5
7 3


Login to submit.


97% Solution Ratio
esh.29Earliest, 5M ago
DoraDemonFastest, 0.0s
akmshohan5123Lightest, 5.2 MB
user.7776Shortest, 204B
Toph uses cookies. By continuing you agree to our Cookie Policy.