Limits 2s, 512 MB

As you all know that it is high time for good and bad boys to do good and bad things in the upcoming Good and Bad tournament. Since the bad boys like to fight with good boys even if they are in the same team in the tournament. That’s why the tournament authority has decided not to mix up bad boys with good boys. Now the tournament authority is having some trouble with the bad boys and the authority needs your help to form the teams for the upcoming tournament since you are the badest boy in the town right now. You will know in advance the total number of boys and the number of bad boys among them. You have to follow the following rules to form the teams:

  • There can be two types of team.

    • With only bad boys as member (Bad Teams)

    • With only good boys as member as (Good Teams)

  • Each Bad Team must have the same number of member

  • Each Good Team Must have the same number of member

  • There must be at least one Bad Team and one Good Team

  • The number of members in a Good Team must be greater than the number of member in a Bad Team.

Now you have to tell the authority, how many numbers of ways you can form the teams for the tournament satisfying the condition mentioned above.

Input

Input starts with an integer TT (0<T1000000 < T \le 100000), denoting the number of test cases.

Each case contains two integer nn (1n1051 \le n \le 10^5) and bb (1b1051 \le b \le 10^5), where nn represents the total number of boys and bb represents the number of bad boys.

Output

For each case print the case number and the number of ways the teams can be formed.

Sample

InputOutput
2
6 2
10 7
Case 1: 3
Case 2: 1

Submit

Login to submit.

Statistics

70% Solution Ratio
CoderFolderEarliest, Jan '18
steinumFastest, 0.0s
nirjoy139Lightest, 5.5 kB
steinumShortest, 491B
Toph uses cookies. By continuing you agree to our Cookie Policy.