Geek Power Inc.

Geek Power (GP) Inc. has recently invented a new kind of power source. They are just like normal power sources, but with one added limitation. You may ask at this point, who would use something new that has more limitations than the existing ones? Well, then you do not know geeks very well. Each of these power sources has a power output rating with it and it can even be used with other power sources of different rating made by the GP only. But here is the limitation — if power sources of various ratings are mixed together, all of them start working at the lowest rating among them. For example, if you add three power sources with rating 3, 5, and 7, then each of them work as a power source of rating 3. Thus, the total power output from this group will be 3 × 3 = 9. However, if you only take 5 and 7 in the group, then each of them work as a power source of rating 5, and thus the total power output is 2 × 5 = 10, which is better than the previous group. In this problem, you will be given a set of power sources made by GP. You have to form a group that produces the highest power output. You can take any number of power sources with any rating from the given list of power sources. Input First line of input is T (at most 200), the number of test cases. For each test case, you will be given an integer n (1 ≤ n ≤ 50), the number of groups of power sources with same power rating, and then n pair of integers (ki,pi) follows. Here, ki is the number of power sources with a rating of pi. You can assumethat,1≤ki ≤100000and1≤pi ≤1000. Output For each test case, print the case number starting with 1 and then the maximum power output that you can achieve. Read sample input output section for details. Sample Input 3 3 13 25 19 4 25 21 21 25 5 21 41 21 33 6 10

2/2 Sample Output Case 1: 15 Case 2: 20 Case 3: 60