A binary string of length is arranged on a circle. Its positions are numbered from to .
You may perform the following operation any number of times.
Consider the minimum number of operations needed to make every character of the string equal to 0. It may be impossible.
There are queries. In the -th query, first flip . Then print the minimum number of operations needed to make the current string all 0. Print -1 if it is impossible.
The operations considered when computing an answer are not actually applied to the string. Between queries, only the single-character flip specified by the query persists.
The input is given from Standard Input in the following format:
For each query of each test case, print the answer on its own line.
If the current string cannot be made all 0, print -1.
Each case is given in the following format:
| 2 | 30 |
|
| 3 | 50 | No additional constraints. |