How much to pay?
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
For his birthday, Zenyk decided to invite Marichka to a restaurant. Since he wanted something exquisite, his choice fell on a restaurant with the interesting name "Shawarma-Kebab".
Having eaten their fill of cat meat, the young people decided to leave the hospitable place and asked for the bill to pay. But whether the waiter ate the wrong mushrooms, or it is customary in this exquisite establishment, instead of a bill, they were brought a piece of paper on which two different numbers \(a\) and \(b\) were written.
The main characters understood nothing, and it was already dark outside, so they decided to pay such an integer amount (in hryvnias, without kopecks) that it is strictly greater than one of these numbers and strictly less than the other.
How much money could they have paid?
Input
The single line contains two integers \(a\) and \(b\) — the numbers written on the piece of paper.
Output
In the single line, print a single integer \(c\), which is greater than one of the
numbers on the paper and less than the other. If such numbers do not
exist, print -1. If there are several such numbers, print
any.
Constraints
\(1 \le a, b \le 2 \cdot 10^9\),
\(a \neq b\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 4 47 | 7 |
| Input (stdin) | Output (stdout) |
|---|---|
| 1 2 | -1 |
Notes
In the second example, there are no integers between 1 and 2, so the
answer is -1.
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|