#K53227. Conditional Product-Sum

    ID: 29485 Type: Default 1000ms 256MiB

Conditional Product-Sum

Conditional Product-Sum

You are given a list of numbers. Your task is to compute the product of all the numbers if the list does not contain any zero. However, if there is at least one zero in the list, instead compute the sum of all the numbers.

Formally, let \(a_1, a_2, \ldots, a_n\) be the given numbers. If \(0 \notin \{a_1, a_2, \ldots, a_n\}\), output \(\prod_{i=1}^n a_i\). Otherwise, output \(\sum_{i=1}^n a_i\).

inputFormat

The first line contains a single integer \(n\) (\(1 \le n \le 10^5\)), the number of elements in the list.

The second line contains \(n\) space-separated numbers. Each number can be either an integer or a floating-point value.

outputFormat

Print a single number — the product of the list if there is no zero; otherwise, print the sum of the list. If the result is an integer, it should be printed without a decimal point.

## sample
4
1 2 3 4
24