Problem D: 编号

Problem D: 编号

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

给 lns="http://www.w3.org/1998/Math/MathML">n 学生分配学号,每个人都需要独一无二的学号。第 lns="http://www.w3.org/1998/Math/MathML">i 个学生要求他的学号为 lns="http://www.w3.org/1998/Math/MathML">1 到 lns="http://www.w3.org/1998/Math/MathML">ai 之间的整数。

请统计有多少种编号方案数满足所有学生的要求。

由于答案可能很大,输出方案数模 lns="http://www.w3.org/1998/Math/MathML">1,000,000,007 的余数。

Input

  • 第一行:单个整数表示 lns="http://www.w3.org/1998/Math/MathML">n
  • 第二行:lns="http://www.w3.org/1998/Math/MathML">n 个整数表示 lns="http://www.w3.org/1998/Math/MathML">a1,a2,,an

Output

  • 单个整数表示答案
    •  的数据,lns="http://www.w3.org/1998/Math/MathML">1n10lns="http://www.w3.org/1998/Math/MathML">1ai10
    • lns="http://www.w3.org/1998/Math/MathML">60% 的数据,lns="http://www.w3.org/1998/Math/MathML">1n100lns="http://www.w3.org/1998/Math/MathML">1ai100
    • lns="http://www.w3.org/1998/Math/MathML">100% 的数据,lns="http://www.w3.org/1998/Math/MathML">1n300,000lns="http://www.w3.org/1998/Math/MathML">1ai109

Sample Input Copy

3
4 7 2

Sample Output Copy

30