#P1866. 编号

编号

Description

Taro has NN rabbits. To make them easier to identify, Taro will assign them numbers. The rabbits expressed their preferences: each rabbit ii wants an integer between 11 and MiM_i (it can be 11 or MiM_i). Of course, the numbers assigned to different rabbits must be distinct. Now Taro wants to know how many ways there are to assign the numbers.

You only need to output the answer modulo 109+710^9+7. If this is impossible, output 00.

Input Format

The first line contains an integer NN. The second line contains NN integers MiM_i.

Output Format

Print a single integer, the total number of ways.

2
5 8

35

Hint

Constraints

For all testdata, 1N501 \le N \le 50, 1Mi10001\le M_i\le 1000.

Translated by ChatGPT 5