Banner Home Page Web Contests Problems Ranklist Status Statistics

Find The Number

Time Limit : 6000/3000ms (Java/Other)   Memory Limit : 0/0K (Java/Other)
Total Submission(s) : 3   Accepted Submission(s) : 0
Problem Description

ABC University has k departments. Each department is assigned a department number. There are many students in each department. The university assigns roll numbers to each student such that the number is divisible by the department number. For example if department number is 5, the students can only get roll numbers 5, 10, 15, etc. The purpose is to identify the department of a student easily from his roll number. So if a number is divisible by more than one department number, then that number will not be assigned to any student (so that there will not be any ambiguity). For example if we have departments 5 and 7, then 35, 70, 105, etc are not used because they are divisible by both numbers.

Everything was going fine until one day, someone hacked into the University database and erased the roll number column in the students table! The Database administrator knows that,

Now given the position (1 based index) of the record in the database, can you find out the roll number corresponding to that record quickly?


Input 

The first line contains one integer t, the number of testcases (1$ \le$t$ \le$50).

This will be followed by `t' test cases, each containing 2 lines.


Constraints:


Output 

For each test case print the roll number corresponding to the nth record in the database. Output of each test-case should be on a separate line.


Note: In the first test-case the roll number sequence will be 2, 3, 4, 8, etc (Note that 6 is not a valid roll number). So the 4th number in this sequence is 8.


Sample Input 

 2  2 4  2 3  3 10  6 11 20


Sample Output 

8  36

 

Source
UVALive
 

Statistic | Submit | Back