##### 题目描述

Recently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the people in this country are still very proud even if their nation hasn’t been so wealthy any more.
The merchants were the most typical, each of them only sold exactly one item, the price was $P_i$, but they would refuse to make a trade with you if your money were less than $Q_i$, and iSea evaluated every item a value $V_i$.
If he had $M$ units of money, what’s the maximum value iSea could get?

$1 \le N \le 500, 1 \le M \le 5000$
$1 \le Pi \le Qi \le 100, 1 \le Vi \le 1000$

##### 代码

###### [一]网上流传式

$f[j]$指拥有$j$元钱时能得到的最大价值

###### [二]CSYdalao式

$dp[j]$指花费j元钱能得到的最大价值

$j$的循环下界是很容易想到的