eolymp
bolt
Try our new interface for solving problems

Duel

Two duelists decided to choose as a venue for the fight dark alley. Along this avenue \textbf{n} grows trees and shrubs. The distance between adjacent objects is equal to one meter. Duel decided to conduct the following rules. A tree is chosen as a starting point. Then, two trees are the same distance from the source are marked as a place to shoot. Duelists begin to move from the starting point in opposite directions. When opponents reach the marked trees, they were unfolding, and start shooting at each other. A scheme of arrangement of trees along the avenue. Required to determine the number of ways to choose a starting point and a place for shooting under the rules of the duel. \InputFile In the input file contains a string of characters '\textbf{0} 'and '\textbf{1}' - scheme of the alley. Trees are denoted by '\textbf{1}', the bushes - a symbol of '\textbf{0}'. The string length does not exceed \textbf{100000} characters. \OutputFile Bring out the many ways to choose a starting point and a place for shooting under the rules of the duel. \Note In the first example, the following configuration of the duel (the starting tree and trees to shoot in bold): \textbf{1}0\textbf{1}0\textbf{1}0101, 10\textbf{1}0\textbf{1}0\textbf{1}01, 1010\textbf{1}0\textbf{1}0\textbf{1} и \textbf{1}010\textbf{1}010\textbf{1}.
Time limit 2 seconds
Memory limit 256 MiB
Input example #1
101010101
Output example #1
4
Author Dmitriy Zhukov
Source Winter School, Kharkov, 2011, Day 2