410386: GYM104015 D Rectangle Restoration
Description
In this problem, you have to restore some data about a rectangle. You know that the sum of lengths of some two sides of this rectangle is equal to $$$x$$$, and the sum of lengths of some three sides of this rectangle is equal to $$$y$$$. Note that each of the four sides of rectangle is included at most once into each of the two sums.
You have to calculate the minimum possible perimeter of a rectangle such that the sum of lengths of some two sides of this rectangle is equal to $$$x$$$, and the sum of lengths of some three sides of this rectangle is equal to $$$y$$$. Note that side lengths are not necessarily integers, but they are strictly positive.
InputThe only line contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^{9}$$$).
OutputIf there is no rectangle meeting the constraints, print $$$-1$$$.
Otherwise, print one real number — the minimum possible perimeter of a rectangle meeting the constraints. The absolute or relative error of your answer must not exceed $$$10^{-4}$$$.
ExamplesInput10 15Output
20.0000Input
6 4Output
7.0000Input
10 2Output
-1Input
7 4Output
7.5000Input
500000000 1000000000Output
1250000000.0Note
In the first example, the rectangle in the answer is a square with side length equal $$$5$$$.
In the second example, the rectangle with minimum perimeter meeting the constraints has two sides with length $$$3$$$ each, and two sides with length $$$0.5$$$ each.
In the third example, there is no rectangle meeting the constraints.
In the fourth example, the rectangle with minimum perimeter meeting the constraints has two sides with length $$$3.5$$$, each, and two sides with length $$$0.25$$$ each.