Bargaining

When he was in the old medina of Marrakech, Mr. Ed and his pals visited a famous Berber market. There were several vendors offering all kind of species, cloths, babouches, lamps and tea pots. As you may imagine, Mr. Ed wanted to buy many souvenirs for all his family. He approached to one of the vendors and asked the price for a pair of babouches, then, the vendor asked “How much are you willing to pay?” Mr. Ed understood that he needed to use his business abilities to set a fair price. “I’ll not pay more than 30 euros for that” — said Mr. Ed, “Let me make you a deal, you give me 35 euros, I give you back 10 dirhams and the babouches are yours” — replied the vendor. Mr. Ed accepted the previous deal and later noticed that he had been cheated! Furious, Mr. Ed decided that he would not be cheated again, so he started to bargain with the vendors to gather information about the prices for a pair of babouches. After several minutes, he managed to bargain with n vendors. The i-th vendor he bargained with gave euros a value of ei and dirhams a value of di. After realizing that, he came up with an inequality of the form: ei EUR ± di MAD > ci, meaning that the total value of euros and dirhams Mr. Ed pays must be more than ci if he expects the vendor to accept; or ei EUR ± di MAD < ci, meaning that he only accepts if the total value of euros and dirhams he pays is less than ci. After gathering such information Mr. Ed was ready to buy again. He still had E euros and D dirhams in his pocket, but now you’re wondering: which was the effective area of prices he could bargain with that money? The effective area of prices is the area of every possible way Mr. Ed could buy the babouches satisfying the n inequalities, assuming any positive real number of euros and dirhams. Input The input will contain several test cases. The first line of each test case contains 3 integers E, D and n, representing the euros and dirhams Mr. Ed had and the number of inequalities gathered (1 ≤ E, D ≤ 1, 000 and 0 ≤ n ≤ 1, 000). The next n lines contains an inequality as shown in the example, the values for ei, di and ci will be integers that satisfy 0 ≤ ei, di ≤ 10, 000 and 0 ≤ |ci| ≤ 10, 000. The last test case is followed by a single line containing 3 zeroes. Output For each test case print a real number with exactly 2 digits after the decimal point, representing the effective area of prices that Mr. Ed could bargain with the vendor (see format below). Hint: Please note that in this problem there is no relation between Euros (EUR) and Moroccan Dirhams (MAD). Sample Input 222 1EUR + 0MAD > 1 1EUR + 0MAD < 1 222 1EUR + 1MAD < 2 1EUR - 1MAD > 1 000

2/2 Sample Output Case #1: 0.00 Case #2: 0.25