Given a binary string of length , where exactly characters are ones, compute the number of substrings that have at least three ones.
are presented in sorted order.
In tests worth marks, you may assume .
In tests worth an additional marks, you may assume .
The first line of the input contains two space-separated integers, and .
Each of the next lines contains a single integer, , indicating that character of the string is a one.
Output a single integer, the number of substrings that contain at least three ones.
5 4 1 2 4 5