SP23938 UJ01 - Save the Scofield !!

Description

Scofield is excellent at math tables, so T-BAG decided to make things a bit more interesting. He gives two numbers A and B and merges the tables of A and B in sorted order (ascending order), removing the duplicates and thus creates supertable of A and B and asks Scofield the Nth number in the supertable.

Input Format

First line contains number of test cases T . Each test case contains three integers A , B and N .Output **Output** For each test case print the N $ ^{th} $ number of the Saratable. Constraints: 1

Output Format

N/A