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.
1≤ n ≤ 10; 1
≤ mi ≤ 20, 1≤ i
≤ n, .
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.
The number of different execution paths.
1 2 3