Binary
/

## String Manipulation

Problem
Editorial
Analytics

Problem Statement:

Given a binary string S, your work is to count the number of such substrings that start and end with 1, if there is no such combination print 0.

For Example:

You are given a string 01101, the total number of substrings which starts and ends with 1 are 11, 101 and 1101.

Input Format:

The first line of the input contains an integer T, which is the number of test cases and the next line denotes the length of the string followed by the string S.

Constraints:

1 <= T <= 10

1 <= S <= 100

Output Format:

Print the count of the total number of substrings for each given string in a new line starting and ending with 1.

Example:
Input:
1
4
1111

Output:
6

SAMPLE INPUT
2
4
1111
5
01101
SAMPLE OUTPUT
6
3
Time Limit: 0.6 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

## Contributors

Initializing Code Editor...