Suspension Bridges

Given the span and the sag of a hanging cable, solve the catenary equation for its parameter and print the cable length to six decimals.

Medium6Binary searchMathImplementationBrute forceNo attempts yetTime limit2sMemory limit512 MB

Problem

Mountain villages attract tourists by building suspension bridges over deep gorges. For the crossing to give people the thrill they came for, the sag at the lowest point of the bridge has to be large compared with the distance the bridge covers.

You are given the distance between the anchor points where the cable is attached and the sag wanted at the center. Compute the length of each cable that holds the bridge.

A free hanging cable takes the shape of a catenary, the same curve a chain forms between two poles. For a horizontal distance dd between the anchor points and a sag ss at the center, there is a positive parameter aa such that

a+s=acoshd2aa + s = a\cosh\frac{d}{2a}

and the length of the cable is

(a,d)=2asinhd2a\ell(a, d) = 2a\sinh\frac{d}{2a}

Here sinh\sinh and cosh\cosh are the hyperbolic sine and the hyperbolic cosine, defined as

sinhx=exex2,coshx=ex+ex2\sinh x = \frac{e^x - e^{-x}}{2}, \qquad \cosh x = \frac{e^x + e^{-x}}{2}

Input

The first and only line contains two integers dd and ss separated by a space (1d10001 \le d \le 1\,000, 1s10001 \le s \le 1\,000).

dd is the distance between the anchor points and ss is the sag wanted at the center of the bridge.

Output

Print the length of cable needed to cover the distance between the anchor points, rounded to six digits after the decimal point, on one line.