#abc169f. [abc169_f]Knapsack for All Subsets
[abc169_f]Knapsack for All Subsets
Problem Statement
Given are a sequence of positive integers , , , and another positive integer .
For a non-empty subset of the set , let us define as follows:
- is the number of different non-empty subsets of such that .
Find the sum of over all subsets of . Since the sum can be enormous, print it modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the sum of modulo .
Sample Input 1
3 4
2 2 4
Sample Output 1
6
For each , the value of is shown below. The sum of these values is .
- (One subset satisfies the condition.)
- ()
- ()
- ()
- ()
Sample Input 2
5 8
9 9 9 9 9
Sample Output 2
0
Sample Input 3
10 10
3 1 4 1 5 9 2 6 5 3
Sample Output 3
3296