#K72382. Total Iterations of Nested Loops
Total Iterations of Nested Loops
Total Iterations of Nested Loops
You are given k nested loops. The first loop runs from 1 to L1, the second from 1 to L2, and so on up to the k-th loop which runs from 1 to Lk. Your task is to compute the total number of times the innermost loop executes. In other words, if each loop runs independently, the total number of iterations is given by the formula: \(\prod_{i=1}^{k} L_i\).
For example, if k = 3 and L = [2, 3, 4], then the loops will execute a total of \(2 \times 3 \times 4 = 24\) times.
inputFormat
The input is given via stdin and consists of two lines:
- The first line contains a single integer k representing the number of nested loops.
- The second line contains k space-separated positive integers, where the i-th integer represents Li, the upper limit of the i-th loop.
outputFormat
Output a single integer to stdout which is the total number of iterations of the innermost loop. This is computed as the product of the k upper limits.
## sample3
2 3 4
24