Monocarp plays a computer game — a tactical RPG, to be specific. Right now, he has to defeat several enemies to win the current battle.
The enemy side of the battlefield can be represented as a row of $$$n$$$ cells, numbered from $$$1$$$ to $$$n$$$ from left to right. Every cell is either empty (represented by the character '0'), or contains an enemy (represented by the character '1').
To win the battle, Monocarp can perform the following actions:
Of course, fireballs are more efficient; however, Monocarp can launch at most one fireball during the battle. Thankfully, he can cast the lightning bolt any number of times.
Your task is to help Monocarp determine the minimum number of actions he has to perform in order to eliminate all enemies.
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of cells.
The second line of each test case contains one string $$$s$$$ ($$$|s| = n$$$). Each character of $$$s$$$ is either '0' (if the corresponding cell is empty) or '1' (if the corresponding cell contains an enemy).
Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$.
For each test case, print one integer — the minimum number of actions Monocarp has to perform in order to eliminate all enemies.
4500000710101018011101109110101100
0434