Ureckon is underway and there are a huge number of coordinators. There are 109 number of tasks to be done numbered 1 to 109. However, they need to be assigned to the many coordinators.There are 3 coordinators who are hardworking and they have the maximum amount of responsibility. The three coordinators are : - Soumyadip, Tathagatha & Sangram. Soumyadip can only be assigned the tasks which are quirky numbers. Quirky numbers are positive integers which can be divided by the ID a or b or c. The ID a or b or c are the ID of the three coordinators respectively.The event convenor wants to know the nth task assigned to any of the three coordinators. Help him find the task number assigned.
The 1st line contains T, the number of testcases. T lines continue.
Each line of the testcase contains four integers n,a,b,c.
Print the nth task number.
1≤T≤105
1≤n,a,b,c≤109
1≤a∗b∗c≤1018
It's guaranteed that the result will be in range [1,2∗109]