#K53117. Sum of Even Numbers in Multiple Lists

    ID: 29461 Type: Default 1000ms 256MiB

Sum of Even Numbers in Multiple Lists

Sum of Even Numbers in Multiple Lists

Given several lists of integers, your task is to compute the sum of all even numbers in each list. If a list does not contain any even numbers, the sum for that list should be 0.

For each list, calculate the sum using the formula \( S = \sum_{i=1}^{n} a_i \) where \( a_i \) is even, otherwise it is not included in the sum.

Please note that the input will be given through standard input (stdin) and you should output the results to standard output (stdout), one result per line corresponding to each list.

inputFormat

The first line of the input contains a single integer \( T \) representing the number of lists.

Each of the following \( T \) lines begins with an integer \( k \) indicating the number of elements in the list, followed by \( k \) space-separated integers.

Example:

3
5 1 2 3 4 5
3 7 11 13
5 2 4 6 8 10

outputFormat

For each list, output the sum of the even numbers on a separate line in the same order as the input lists.

Example Output:

6
0
30
## sample
1
5 1 2 3 4 5
6

</p>