#C14589. Sum of Evens and Product of Odds

    ID: 44254 Type: Default 1000ms 256MiB

Sum of Evens and Product of Odds

Sum of Evens and Product of Odds

You are given a list of integers. Your task is to calculate two values:

  • Even Sum: The sum of all even numbers in the list. Formally, \( S = \sum_{x \in A,\, x \text{ is even}} x \).
  • Odd Product: The product of all odd numbers in the list. Formally, \( P = \prod_{x \in A,\, x \text{ is odd}} x \). However, if the list does not contain any odd numbers, then define \( P = 0 \).

If the list is empty, both values are defined as 0.

Print the two results on a single line separated by a space.

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  1. The first line contains a single integer \( n \) denoting the number of integers in the list.
  2. The second line contains \( n \) space-separated integers.

outputFormat

Print two integers separated by a single space:

  • The first integer is the sum of all even numbers.
  • The second integer is the product of all odd numbers (or 0 if there are no odd numbers).
## sample
8
1 2 3 4 5 -6 -7 0
0 105

</p>