2323: Just for cake

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:18 解决:6

题目描述

  It's time for cake!!!
    Shen,a excellent BUCT ACMer,reached the place that Liu Sir had informed early in the morning.There are many pieces of cakes and Shen has a bag of the volume Vol cm3(He Qu Nian Mai Le Ge Bao). Before Shen takes cakes,Liu Sir says,"Before taking the cakes ,you need to set some questions for the BUCT oj."
    The ith problem is set for the ith cake ,which will cost Shen power[i] energy and time[i] time . And the ith cake is V[i] cm3.Thanks to the plenty of sleep, he has got P energy.Shen wants to know the minimum time if he use these energy to take the maximum pieces of cakes.

输入

    First line has an integer N, indicating the number of cakes. Then in the following N lines, each line has 3 integers, which respectively means V[i] Power[i] and time[i]. The N+1 line has 2 integers Vol and P.(1<=N,P,Vol<=100)

输出

Output the minimum time.

样例输入 复制

4
1 2 5
2 1 6
2 2 1
2 2 3
5 5

样例输出 复制

12