Time limit: 0.05s
Memory limit: 256MB
Input:
Output:
We are given an array of length . The green operation applied to consists of two steps:
- We create an array , which is at first empty. We consider all subsets of , including the empty subset, we compute the sum of the values there and then we add these sums in .
- becomes and is once again empty.
Task
You must print the sum modulo of the values from after applying the green operation times.
Input data
The input will contain on the first line , and . The next line will contain the values from array .
Output data
The first line will contain a single number, the required sum.
Constraints and clarifications
- is odd.
# | Score | Constraints |
---|---|---|
1 | 20 | , |
2 | 10 | , |
3 | 10 | |
4 | 20 | , |
5 | 20 | , |
6 | 20 | No additional constraints |
Example 1
stdin
3 1 9999
1 2 3
stdout
24
Explanation
In the first example, array after the green operation is .
Example 2
stdin
3 4 29
0 23 0
stdout
26
Example 3
stdin
4 50000 49999
2 0 2 3
stdout
43310