Author: | A. Klenin | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
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 contains three integers y xt yt — coordinates of laser and target.
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.
1 ≤ y, xt, yt ≤ 109
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|