J. Pluto
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Shortly after solving their previous dilemma, the Plutonian government has asked for your help once again. There is a special vault in the heart of the Plutonian capitol, and the government needs to unlock it (don't ask why), but the process of doing so is quite complex so they've requested your help.

The vault has a lock consisting of $$$n$$$ switches, numbered $$$1...n$$$, where $$$n$$$ is odd. The initial state of the lock is given as a bitstring of length $$$n$$$, where the $$$i$$$-th character represents the state of the switch $$$i$$$, and a '1' denotes that the switch is up while a '0' denotes that it is down. To unlock the safe, all of the switches need to be down. You want to unlock the lock, but you can only perform the following two operations on the lock:

  • Flip two adjacent switches. In other words, choose some $$$i$$$ such that $$$1 \leq i \leq n - 1$$$ and flip the value of switch $$$i$$$ and $$$i + 1$$$ simulatneously.
  • Flip all switches simultaneously.

The Plutonian government is short on time, so they want you to determine the minimum number of operations necessary to set all switches to the down ('0') state.

Of course it isn't that simple though. After all, the government is short on time because every minute for $$$q$$$ minutes the state of the lock changes. During the $$$i$$$th update, all switches $$$j$$$ such that $$$l_i \leq j \leq r_i$$$ are flipped. Note that the updates persist. Please help the Plutonians and output the minimum number of operations to set all switches to the down state after each update.

Input

The first line of input will consist of two integers $$$n$$$ and $$$q$$$ ($$$3 \leq n \leq 2 \cdot 10^5$$$, $$$1 \leq q \leq 2 \cdot 10^5$$$, $$$n$$$ is odd) — denoting the number of switches in the lock and the number of updates respectively.

The next line contains a bitstring $$$s$$$ of length $$$n$$$ ($$$s_i \in \{'0', '1'\}$$$) — denoting the state of the lock.

The $$$i$$$-th of the next $$$q$$$ lines contains integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \leq l_i \leq r_i \leq n$$$) — denoting that during the $$$i$$$-th update the state of the locks from $$$l_i$$$ to $$$r_i$$$ are flipped.

Output

Output $$$q$$$ lines, each with a single integer denoting the minimum number of operations needed to unlock the lock after each update occurs.

Examples
Input
7 3
1101010
4 7
1 3
5 6
Output
3
4
3
Input
9 2
000000001
9 9
1 9
Output
0
1