You are given a binary string S of length N. A substring of a binary string is called positive if the number of 1′s present in the substring is strictly greater than the number of 0′s present. Find the number of positive substrings in the given string S
Input format
Output format
For each test case, print the number of positive substrings in the given string S
Constraints
1≤T≤1051≤N≤3⋅105Scontains′0′sand′1′s.SumofNoveralltestcasesdoesnotexceed3⋅105.
In the first test case, the positive substrings are S1…1=1,S3…3=1,S1…3=101.
In the second test case, the positive substrings are S1…1=1,S4…4=1,S5…5=1,S4…5=11,S3…5=011,S1…5=10011.