By Julio Cesar Ceron, URI Online Judge Brazil
With the arrival of Christmas atmosphere many families around the world decorate their homes, they put lights build their own Christmas tree, putting the most varied decorations always smartly. Family Enilno Egduj, descendetes of Italians, always very organized and perfectionist created a tradition where every year someone is responsible for decorate the Christmas tree. This year the youngest child of Rolien Enilno Egduj family, was in charge of making the decor, and it needed to buy the ornaments for the tree. For those unfamiliar Rolien, he is a very perfectionist boy, such a perfectionist that descidiu make a program to assist you in your task.
To decorate the tree were available in the market where Rolien was looking for Christmas decorations, several packages with X amount of ornaments and each package its respective weight in grams. Based on this information Rolien stipulated that each branch could support a quantity K in grams.
With that I needed to find what the best option among the packages, ie packages which it should take that combined have the largest number of decorations and the branch to which it will spruce can withstand withstand the weight of ornaments.
The first input line has an integer G to the tree branches, and also representing the number of test cases, the second inlet line has an integer P (1 < P < 100) indicating the number of packets, the next an entire line has W (1 < W < 1000), which indicates the weight capacity of the tree branch supports. The next P lines indicate the number of ornaments on fied package E(1 < E ≤ 300) and the weight of each package PC (1 ≤ PC ≤ W).
The output must submit the total number of decorations for each branch. Print a blank line after the full trappings of each branch.
|Input Sample||Output Sample|