#C7151. Sum of Even Numbers Times Highest Odd Number

    ID: 50991 Type: Default 1000ms 256MiB

Sum of Even Numbers Times Highest Odd Number

Sum of Even Numbers Times Highest Odd Number

You are given an array of integers. Your task is to compute the sum of all even numbers in the array, and then multiply this sum by the highest odd number in the array. If there is no odd number present, the output should be 0.

The problem is defined as follows:

Let \(S_E\) be the sum of all even numbers and \(M_O\) be the maximum odd number in the array. Then the output is \(S_E \times M_O\). If the array contains no odd numbers, output 0.

Input Format:

  • The first line contains a single integer \(n\) representing the number of elements in the array.
  • The second line contains \(n\) space-separated integers.

Output Format:

  • Output a single integer which is the computed value.

inputFormat

The input consists of two lines:

  • The first line contains an integer \(n\), denoting the number of elements in the array.
  • The second line contains \(n\) space-separated integers representing the elements of the array.

outputFormat

Output a single integer which is the sum of all even numbers multiplied by the highest odd number. If there is no odd number in the array, output 0.

## sample
5
2 3 4 5 6
60