Author: | A. Klenin, M. Sporyshev | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
Young programmer Vasya tinkered with robots, and decided to create a new startup Easy Patrol with the goal of producing robot guardian to replace human guards.
As a first step, he considered a single wall of N meters in length and two patrolling robots moving back and forth along it.
First robot starts patrolling at the point located x meters from the left edge of the wall, moving to the right. Second robot starts patrolling at the point located y meters from the left edge of the wall, moving to the left.
Each second, events happen in the following order:
Your program must determine maximum possible distance between two robots.
Input file contains integers N, x, y.
Output file must contain a single integer — maximum distance between robots in meters.
4 ≤ N ≤ 106
0 ≤ x, y ≤ N
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|