#Lutece0132. Coprime

Coprime

Migrated from Lutece 132 Coprime

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Please write a program to calculate the kthk_{th} positive integer that is coprime with mm and nn simultaneously. AA is coprime with BB when their greatest common divisor is 11.

Input

The first line contains one integer TT representing the number of test cases.

For each case, there's one line containing three integers mm, nn and kk (0<m,n,k1090 < m, n, k \leq 10^9 ).

Output

For each test case, in one line print the case number and the kthk_{th} positive integer that is coprime with mm and nn.

Please follow the format of the sample output.

Samples

3 
6 9 1 
6 9 2 
6 9 3
Case 1: 1 
Case 2: 5 
Case 3: 7

Resources

The 5th Guangting Cup Central China Invitatio