atcoder#ABC279D. [ABC279D] Freefall

[ABC279D] Freefall

Score : 400400 points

Problem Statement

A superman, Takahashi, is about to jump off the roof of a building to help a person in trouble on the ground. Takahashi's planet has a constant value gg that represents the strength of gravity, and the time it takes for him to reach the ground after starting to fall is Ag\frac{A}{\sqrt{g}}.

It is now time 00, and g=1g = 1. Takahashi will perform the following operation as many times as he wants (possibly zero).

  • Use a superpower to increase the value of gg by 11. This takes a time of BB.

Then, he will jump off the building. After starting to fall, he cannot change the value of gg. Additionally, we only consider the time it takes to perform the operation and fall.

Find the earliest time Takahashi can reach the ground.

Constraints

  • 1A10181 \leq A \leq 10^{18}
  • 1B10181 \leq B \leq 10^{18}
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

AA BB

Output

Print the earliest time Takahashi can reach the ground. Your output will be accepted when its absolute or relative error from the true value is at most 10610^{-6}.

10 1
7.7735026919
  • If he performs the operation zero times, he will reach the ground at time 1×0+101=101\times 0+\frac{10}{\sqrt{1}} = 10.
  • If he performs the operation once, he will reach the ground at time 1×1+1028.071\times 1+\frac{10}{\sqrt{2}} \fallingdotseq 8.07.
  • If he performs the operation twice, he will reach the ground at time 1×2+1037.771\times 2+\frac{10}{\sqrt{3}} \fallingdotseq 7.77.
  • If he performs the operation three times, he will reach the ground at time 1×3+104=81\times 3+\frac{10}{\sqrt{4}} = 8.

Performing the operation four or more times will only delay the time to reach the ground. Therefore, it is optimal to perform the operation twice before jumping off, and the answer is 2+1032+\frac{10}{\sqrt{3}}.

5 10
5.0000000000

It is optimal not to perform the operation at all.

1000000000000000000 100
8772053214538.5976562500