Vasya has written a program that launches n
threads having mi instructions each.
At any point in time the CPU is executing a
single instruction from a single thread. The instructions in a thread are
always executed in order (switching to other threads is possible).
After all instructions in a thread have
been executed, the CPU ignores this thread.
Let us define an execution path as
an ordered list of actually executed instructions from different threads.
Write a program to calculate the number of
different execution paths (accounting for all possible switches between
threads) for a multi-threaded program.
Limitations
1≤ n ≤ 10; 1
≤ mi ≤ 20, 1≤ i
≤ n,
.
Input
The first line of the input file defines
the number of threads n.
The second line contains n
space-delimited integers mi, the number of
instructions in the threads.
Output
The number of different execution paths.
Input
|
Output
|
2
2 2
|
6
|
3
1 2 3
|
60
|