Xiao C opened a hotel called CC Hotel.
One day, $n$ guests arrived at CC Hotel. Xiao C needs to accommodate all of them on a single floor of the hotel. Each room can accommodate only one guest.
There are $m$ rooms on this floor, all of which are currently empty. These $m$ rooms are arranged in a circle, meaning that for all $1 \le x \le m$, room $x$ is adjacent to room $((x \bmod m)+1)$, and room $((x \bmod m)+1)$ is adjacent to room $x$, where $x \bmod m$ denotes the remainder of $x$ divided by $m$.
The $n$ guests are very picky; they wish for no one to be in the rooms adjacent to their own. For a given guest, if $k$ rooms adjacent to their room are occupied, this guest will generate $k$ points of anger.
You need to help Xiao C arrange the rooms to minimize the total sum of anger values of all guests, and output this minimum sum.
Input
Two integers $n, m$.
Output
A single integer representing the minimum total sum of anger values of all guests.
Examples
Input 1
3 5
Output 1
2
Note 1
For these $5$ rooms, one possible arrangement satisfying the conditions is: empty, occupied, occupied, empty, occupied.
It can be proven that the minimum total sum of anger values for all guests is $2$.
Input 2
1 4
Output 2
0
Constraints
For $100\%$ of the data, $1 \le n \le 100$, $3 \le m \le 100$, and it is guaranteed that $n \le m$.
| Test Case ID | Special Property |
|---|---|
| $1\sim3$ | Guaranteed $2n \le m$ |
| $4\sim6$ | Guaranteed $m = n+1$ |
| $7\sim10$ | None |