#K73147. Sum of Even Numbers

    ID: 33911 Type: Default 1000ms 256MiB

Sum of Even Numbers

Sum of Even Numbers

Given a list of integers, your task is to compute the sum of all even numbers. An integer is even if it is divisible by 2. The sum should include negative even numbers and zero as well.

You need to implement the solution such that it reads input from standard input and produces the output to standard output. The sum is calculated using the formula: \(S = \sum_{i=1}^{n} \text{even}(a_i)\), where \(\text{even}(a_i) = a_i\) if \(a_i\) is even, otherwise 0.

inputFormat

The input is provided via standard input. The first line contains an integer \(n\), representing the number of integers in the list. The second line contains \(n\) space-separated integers.

outputFormat

Output a single integer which is the sum of all even numbers in the list to standard output.

## sample
3
2 4 6
12