The statement of this problem is similar to the previous one. But here, you must solve a different problem:
Given a collection of coins , how many subsets of are such that ?
Input consists of several cases, each one with followed by . Assume and .
For every case, print the number of subsets such that . Since this number can be huge, compute it modulo .
Input
1 0.3 5 0.5 0.5 0.5 0.5 0.5
Output
0 31