#T648. OJ积分购物
OJ积分购物
Description
Xiao Wei, as a COIer, frequently submits and solves problems on OJ platforms, earning various types of OJ points.
Xiao Wei has four types of OJ points with denominations of , , , and .
Xiao Wei goes shopping times. For each shopping trip, he carries units of the -th type of points and wants to purchase an item worth . For each trip, determine how many ways there are to pay for the item.
Input Format
The first line of input consists of five integers: , , , , and .
The next lines each contain five integers describing a shopping trip: , , , , and .
Output Format
For each shopping trip, output a single integer representing the answer.
1 2 5 10 2
3 2 3 1 10
1000 2 2 2 900
4
Hint
【Data Range】
For 100% of the data, it is guaranteed that , and .
Source
Adapted from a 2008 provincial selection problem.