Don Giovanni’s Last Dinner

Don Giovanni eats large dishes–a lot of them. Leporello cannot help but drool over. Whenever Don Giovanni gives up a dish, Leporello has a chance: he can have what remains on the dish behind the back of the master, and surely he starts consuming it immediately. But he is a servant, and he has to answer to demands from his master. It is going to be embarrassing if he is mouthful when the master asks him questions. Write a program to determine if Leporello is mouthful every time Don Giovanni calls him. Input The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs. The first line of the input contains Don Giovanni’s eating rate R, Leporello’s eating rate r, the number of dishes N, and the number of calls C. Then there are N lines, each for a dish. Each line contains two numbers s and g with s > g > 0 : s is the amount of food on the dish, and g is the amount Don Giovanni consumes. Don Giovanni will eat the dishes sequentially in the same order given by these n lines. As soon as Don Giovanni stops eating a dish, it is handed to Leporello, and Don Giovanni starts the next dish right away. Leporello eats as long as (and as soon as) there is food for him, and if you want to know, he eats the dishes sequentially in the same order too. Then there are C lines, each for a call. Each line contains a number t for a time when Don Giovanni calls Leporello. (Amazingly, these calls do not slow down Don Giovanni’s eating.) The sequence of call times is increasing. All input numbers are positive integers and at most 2000. Output For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line. For each call, output a line full if Leporello is eating at the time of the call, and clear otherwise. Boundary case: What if Leporello is just about to start or stop eating at a call time? E.g., he receives food at 20, he finishes eating at 40, and at both times he gets called. In both cases, answer ‘full’. (This also nicely handles the case when he finishes a dish at 35, he receives another dish at 35, and he gets called at 35.) Sample Input 1 10 7 5 4

2/2 60 30 150 125 55 35 70 40 42 38 2 10 19 23 Sample Output clear clear full full