#abc262d. [abc262_d]I Hate Non-integer Number
[abc262_d]I Hate Non-integer Number
Problem Statement
You are given a sequence of positive integers of length .
There are ways to choose one or more terms of . How many of them have an integer-valued average? Find the count modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
2 6 2
Sample Output 1
6
For each way to choose terms of , the average is obtained as follows:
-
If just is chosen, the average is , which is an integer.
-
If just is chosen, the average is , which is an integer.
-
If just is chosen, the average is , which is an integer.
-
If and are chosen, the average is , which is an integer.
-
If and are chosen, the average is , which is an integer.
-
If and are chosen, the average is , which is an integer.
-
If , , and are chosen, the average is $\\frac{a_1+a_2+a_3}{3}=\\frac{2+6+2}{3} = \\frac{10}{3}$, which is not an integer.
Therefore, ways satisfy the condition.
Sample Input 2
5
5 5 5 5 5
Sample Output 2
31
Regardless of the choice of one or more terms of , the average equals .