Chicken Lover

Abir loves to eat. Every time he visits a restaurant he wants to eat a chicken item. But chicken item may not be always available. In each day he visits m restaurants consecutively. Each restaurant (i = 1, . . . , m) can make ni different items (Number of Chicken item is exactly 1). But in a single day each restaurant prepares exactly ki items (chosen randomly from ni items). Find expected number of chicken items Abir can eat in a single day. Input Input starts with an integer T (≤ 125), denoting the number of test cases. Each case starts with a line containing an integer m (1 ≤ m ≤ 10000) which denotes number of visiting restaurants. Then in the following line there will bempairofnumbersni andki (1≤i≤m,1≤ni ≤20,1≤ki ≤ni). Output For each case, print expected number of chicken items Abir can eat in a single line in the format P/Q, where P and Q are relatively prime (i.e. no common factor > 1, between P and Q). Explanation for Sample Case In the first case, total no of item is one (one chicken item) and probability of getting 1 chicken item is one. So expected number of chicken item is 1. In the second case, probability of getting 1 chicken item is 1/2 and probability of getting 2 chicken itemsis1/4. Soexpectednoofchickenitemis1×1/2+2×1/4=2/2=1/1. Sample Input 3 1 11 2 2121 1 32 Sample Output Case 1: 1/1 Case 2: 1/1 Case 3: 2/3