Problem E. Emitting light

Author:A. Klenin
Input file: input.txt   Time limit:1 sec
Output file: output.txt   Memory limit:256 Mb

Statement

Young physicist Masha studies lasers. Masha wants to create a simplest 2-dimensional waveguide, consisting of two very long parallel mirrors, one coinciding with the Ox axis, and another located h millimeters above the first.

Masha's laser is located at coordinates (0, y) and emits light in direction (1, −1). Masha wants to hit a target located at coordinates (xt, yt) by choosing a good value for h. All coordinates are in millimeters.

Note that laser itself must fit into the waveguide, so h ≥ y. Both mirrors and laser are perfect, so light is always fully reflected at 45 degrees angle.

Input file format

Input file contains three integers y xt yt — coordinates of laser and target.

Output file format

Output file must contain a single integer — value of h. If there are several solutions, output the smallest one. If there are no solutions, output 1.

Constraints

1 ≤ y, xt, yt ≤ 109

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
5 2 2
-1
2
5 6 1
5
3
2 16 2
2

0.027s 0.007s 9