Andrey fills a table in a «snake» pattern: in the first row, he writes numbers in increasing order from left to right, starting with 1, then he continues in the second row from right to left, then in the third row — again from left to right, and so on. In this table, a 2 x 2 fragment was found with the numbers
| a+1 | a |
| b | b+1 |
Determine the maximum number of columns that could have been in Andrey's table.
Two integers $$$a$$$ and $$$b$$$ are given, each on a separate line ($$$1 \le a, b \le 10^9$$$).
Output a single integer — the answer. If there is no solution, output -1.
Solutions that work correctly for $$$a, b \le 1000$$$ will score at least 30 points.
Solutions that work correctly for $$$a, b \le 10^6$$$ will score at least 60 points.
48
3
The table in the example looks like this:
| 1 | 2 | 3 |
| 6 | 5 | 4 |
| 7 | 8 | 9 |