问题2483--Strange Prime

2483: Strange Prime

时间限制: 1 Sec  内存限制: 128 MB
提交: 1  解决: 1
[提交] [状态] [讨论版] [命题人:]

题目描述

Bobo finds a strange prime P = 1010 + 19 in ICPCCamp, and he decides to write n integers x1, x2, . . . , xn
whose sum is a multiple of P, while xi should satisfy 0 ≤ xi < P − ai for given a1, a2, . . . , an.
Bobo would like to know the number of different ways to write x1, x2, . . . , xn modulo (109 + 7).

输入

The input contains zero or more test cases and is terminated by end-of-file. For each test case:
The first line contains an integer n. The second line contains n integers a1, a2, . . . , an.
• 1 ≤ n ≤105
• 0 ≤ ai≤ 105
• The sum of n does not exceed 106.

输出

For each case, output an integer which denotes the number of different ways.

样例输入

2
0 0
3
0 1 2

样例输出

999999956
2756

来源/分类


[提交] [状态]