Strange Prime
题号:NC52853
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld

题目描述

Bobo finds a strange prime in ICPCCamp,
and he decides to write n integers whose sum is a multiple of P, while x_i should satisfy for given .
Bobo would like to know the number of different ways to write modulo .

输入描述:

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 .

*
*
* The sum of n does not exceed .

输出描述:

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

输入

复制
2
0 0
3
0 1 2

输出

复制
999999956
2756