Your exam is over and you are about to get your grade. You have got marks in n subjects and for each subject you are given two integers pi and mi, pi is the mark you obtained and mi is the total mark in ith subject.
Now, your teacher is about to remove d of the subjects, and after that she will calculate your average grade by the following rule. She first adds the total marks mi for the remaining subjects, let this summation be M. And then she adds the marks you obtained in those subjects, let this summation be P. So, your grade is (P/M) * 100.
Now, you requested your teacher to give you the permission to remove these d subjects by yourself and she agreed. So, given all the marks, your task is to remove exactly d subjects such that your average grade becomes as high as possible.
For example, there are three subjects and your marks are 5, 7 and 10 and the total marks in the subjects are 10, 20 and 15 respectively. And let d be 1. So, if you remove the second subject, your grade becomes 60% (15/25 * 100) which is the best you can do.
Input
Input starts with an integer T (≤ 25), denoting the number of test cases.
Each case starts with a blank line. Next line contains two integers n (2 ≤ n ≤ 20000) and d (1 ≤ d < n). Each of the next n lines contains two integers pi and mi (1 ≤ mi ≤ 1000, 0 ≤ pi ≤ mi) where pi is the mark you obtained and mi is the total mark in ith subject.
Output
For each case, print the case number and the best average grade you can have. Errors less than 10-6 will be ignored.
Sample
Sample Input | Sample Output |
---|---|
2 3 1 5 10 7 20 10 15 5 3 1 2 5 9 3 8 4 10 1 3 | Case 1: 60 Case 2: 54.545454545 |
Notes
Dataset is huge, use faster I/O methods.