5042: BZOJ1042:[HAOI2008]硬币购物

Memory Limit:162 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

  硬币购物一共有4种硬币。面值分别为c1,c2,c3,c4。某人去商店买东西,去了tot次。每次带di枚ci硬币,买s
i的价值的东西。请问每次有多少种付款方法。


输入格式

  第一行 c1,c2,c3,c4,tot 下面tot行 d1,d2,d3,d4,s,其中di,s<=100000,tot<=1000


输出格式

  每次的方法数


样例输入

1 2 5 10 2
3 2 3 1 10
1000 2 2 2 900

样例输出

4
27

提示

没有写明提示


题目来源

没有写明来源

加入题单

算法标签: