AT_past202209_h 3種の硬貨
Description
Takahashi has $ 0 $ gold coins, $ 10^9 $ silver coins, and $ X $ bronze coins.
A shop sells $ N $ bags. For $ i = 1, 2, \ldots, N $ , the $ i $ -th bag can be bought by paying $ A_i $ silver coins and $ B_i $ bronze coins. The $ i $ -th bag contains $ C_i $ gold coins; by buying the bag, he obtains the gold coins in it.
A gold coin is worth $ 10^{100^{100}} $ yen (the currency in Japan), a silver coin is worth $ 10^{100} $ yen, and a bronze coin is worth $ 1 $ yen. Takahashi wants to buy some (possibly zero) of the $ N $ bags and maximize the resulting total value of the gold, silver, and bronze coins he has. Print the numbers of gold, silver, and bronze coins, when the resulting total value of the gold, silver, and bronze coins is maximized.
The bronze and silver coins required for buying a bag cannot be substituted by another kind of coin. For example, a silver coin is worth $ 10^{100} $ bronze coins when converted into yen, but it does not mean you can pay a silver coin instead of paying bronze coins.
Input Format
Input is given from Standard Input in the following format:
> $ N $ $ X $ $ A_1 $ $ B_1 $ $ C_1 $ $ A_2 $ $ B_2 $ $ C_2 $ $ \vdots $ $ A_N $ $ B_N $ $ C_N $
Output Format
Print the numbers of gold coins $ P $ , silver coins $ Q $ , and bronze coins $ R $ , when the resulting total value of the gold, silver, and bronze coins is maximized. The numbers should be printed in the following format, separated by spaces:
> $ P $ $ Q $ $ R $
Explanation/Hint
### Sample Explanation 1
If Takahashi buys the $ 1 $ -st and $ 5 $ -th bags, he will pay $ A_1+A_5 = 2 + 1 = 3 $ silver coins and $ B_1+B_5 = 2 + 2 = 4 $ bronze coins, and obtain $ C_1+C_5 = 3 + 2 = 5 $ gold coins. As a result, he will have $ 5 $ gold coins, $ 10^9-3 $ silver coins, and $ 0 $ bronze coins, for a total value of $ 5 \times 10^{100^{100}} + (10^9-3) \times 10^{100} + 0 \times 1 $ yen, which is maximum possible.
### Constraints
- $ 1 \leq N \leq 3000 $
- $ 0 \leq X \leq 3000 $
- $ 0 \leq A_i, B_i \leq 3000 $
- $ 1 \leq A_i + B_i $
- $ 1 \leq C_i \leq 3000 $
- All values in input are integers.