#C5217. Compute List Result

    ID: 48842 Type: Default 1000ms 256MiB

Compute List Result

Compute List Result

You are given an integer T representing the number of elements in a list, followed by T integers. Your task is to compute a result based on the following rule:

  • If the number of even integers is greater than or equal to the number of odd integers, output the sum of all elements, i.e. \(\sum_{i=1}^{T} a_i\).
  • If the number of odd integers is greater than the number of even integers, output the product of all elements, i.e. \(\prod_{i=1}^{T} a_i\).

It is guaranteed that the input provided will follow the format where the first line contains the integer T followed by a second line containing exactly T space-separated integers.

inputFormat

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

  1. The first line contains a single integer T, the number of elements.
  2. The second line contains T space-separated integers.

outputFormat

Output a single integer to stdout which is the computed result as per the rule described above.

## sample
4
1 2 3 4
10