题目描述
Problem Description
Given integers $ X, L, R $, output the integer within the range $ L $ to $ R $ (inclusive) that has the smallest absolute difference with $ X $. It can be proven that exactly one such integer exists.
Input Format
The input is given from the standard input in the following format:
$ X $ $ L $ $ R $
Output Format
Output the integer within the range $ L $ to $ R $ (inclusive) that has the smallest absolute difference with $ X $.
Sample Input and Output
Sample Input #1
8 3 6
Sample Output #1
6
Sample Input #2
7 3 10
Sample Output #2
7
Sample Input #3
8 10 10
Sample Output #3
10
Notes/Hints
Constraints
- $1 \leq X \leq 100,000$.
- $1 \leq L \leq R \leq 100,000$.
Sample Explanation 1
Among $ 3, 4, 5, 6 $, the one with the smallest absolute difference with $ 8 $ is $ 6 $. Therefore, output $ 6 $.
Sample Explanation 2
Among $ 3, 4, 5, 6, 7, 8, 9, 10 $, the one with the smallest absolute difference with $ 7 $ is $ 7 $. Therefore, output $ 7 $.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
8 3 6
样例输出
6