Writing the Whole

Unless you are living under the rock you may have heard the name of Nawab SiRaj-ud-doula (we call him NSR for simplic- ity). If you indeed live under the rock then let me say something about him. He was smart and very good at programming and mathematics. One of his favorite hobbies is to write the π to its whole, 3.14159. As you might be wondering 3.14159 is not the whole of π and his friends say so. His friends tried to convince him that he can’t write irrational numbers to their whole. As an example they say that even 3.14159 is not the best approximation of π using 7 symbols. It is 355/113. This made NSR interested. So he decided to ask his friends for good approximation of different irrational numbers. Input The first line of input will contain T (≤ 10000) denoting the number of cases. Eachcasecontainsthreeintegersm(1<m≤10),n(1<n≤10000)andp(1<p≤10). Now NSR wants you to find the best approximation of m-th root of n using at most p symbols. You may assume that it will always be an irrational number. You may also assume that n < 10p∗m. For this problem, digits, ‘.’ and ‘/’ are treated as symbols. To make the problem easier, at most one non-digit symbol can be used to approximate the number. Output For each case, print the case number and the approximation as described in problem statement. If there are multiple solutions, output the one with least number of symbols. If there is still a tie, output the lexicographically earlier one. Sample Input 2 428 429 Sample Output Case 1: 1.189207 Case 2: 8969/7542