Coin Change (Number of Ways)
In how many ways can you make using unlimited coins of the given distinct values? Order doesn't matter (1+2 and 2+1 are the same). Print modulo .
Input
, the distinct coin values, then .
Output
The number of ways modulo 1000000007.
Constraints
,
Sample 1
Input
3 1 2 5 5
Output
4
Sample 2
Input
1 2 3
Output
0