Milo of Croton was a wrestler who won the Olympic games six times and was famous for his strength. The story goes that he held up the ceiling of a collapsing building until Pythagoras was safely out. One of the ways he built that strength was a training regimen: he carried a calf around the village once a day, and he kept it up until the calf had grown into a full bull.
This problem looks at Milo's regimen a little more carefully. Carrying a young bull around the village has two effects. He is sore for the next few days and can lift less weight, and he builds muscle that lets him lift more weight later. For each day, equivalently for each weight of the calf, you are given two numbers: a permanent strength increase that kicks in 3 days after the exercise, and a soreness penalty that applies on the next 2 days after the exercise. Both the strength increases and the soreness penalties are cumulative. If Milo exercises two days in a row, then on the day after that he is sore from both, and on the second day after that he is sore only from the second exercise while the strength from the first one has arrived.
You are told how much the calf weighed on the first day, how much Milo could lift on the first day, how many days Milo wants to exercise, and what the exercise effects are at each weight of the calf. When Milo's ability to lift equals the weight of the calf he lifts it successfully, but when it is strictly less he fails. Milo exercises every day, and the calf gains one pound every day. Determine whether Milo can finish his entire regimen, and if not, on what day he first fails.
The first line contains the number K of data sets. The K data sets follow, each in the form below.
The first line of a data set contains three integers w, c, d separated by spaces. w is the weight Milo can lift on day 1, with 0≤w≤1000. c is the weight of the calf on day 1, with 0≤c≤1000. d is the number of days Milo plans to exercise, with 1≤d≤100.
Then d lines follow. Line i=1,…,d describes the effect of carrying the calf around the village when it weighs c+i−1, that is, on day i. It contains two integers gi, si. gi is the permanent strength gain from carrying the calf, which kicks in on day i+3, with 0≤gi≤1000. si is the soreness penalty, which reduces how much he can lift on days i+1 and i+2, with 0≤si≤100.
For each data set, output Data Set x: on a line by itself, where x is the number of that data set.
If Milo can finish his entire regimen, output Completed successfully. Otherwise output the number of the first day on which Milo cannot carry the calf any more.
Follow each data set with a blank line.