~N~ houses, all equally spaced apart. Each house either has the lights on or off. rates a house with a score equal to the minimum distance, in house units, that he must travel to be at a house that has its lights on.lives on a street with
wants to compute the sum of the ratings of all the houses on his street.
~1 \le N \le 10^6~
In tests worth 5 marks, ~N \le 10^3~.
At least one house will always have its lights on.
The first line contains a single positive integer, ~N~.
The next line contains a binary string. If the ~i~th character of the string is
1, then the ~i~th house has its lights on. Otherwise, the ~i~th character of the string is
0 and that house has its lights off.
Output the sum of all the ratings.
Sample Input 1
Sample Output 1
Explanation for Sample 1
Every house is illuminated, so every house has a rating of 0.
Sample Input 2
Sample Output 2
Explanation for Sample 2
The first and last house have ratings of 0, and the second and third house each have a rating of 1.