The MarkiT online virtual market startup wants to organize its grand opening in NIT Patna.
but they want maximum crowd for their inauguration. So the manager told  this  to Praveen a student in NITP who suggested them:
The first-year students come to campus  every x hour,
Second-year students come to campus every y hour,
Third-year students come to campus every z hour and 
Fourth-year is very busy so they don't come regularly.
So Praveen being very clever told him the no of times in n days he can have an audience of all year student (1st,2nd & 3rd) at max. So can you code what Praveen has done?
-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a 2 line of input, first line contain one  integers $N$ (No of Days). 
-Next line contain 3 space separated integer the  value of x y z
-----Output:-----
For each testcase, output in a single line answer the no of times audience consists of all year.
-----Constraints-----
- $1 \leq T \leq 1000$
- $1 \leq N \leq 10^8$
- $1 \leq x,y,z \leq 10^5$
-----Sample Input:-----
1
10
8 10 6
-----Sample Output:-----
2
-----EXPLANATION:-----
First favourable condition will come on 5th day and Second on 10th day.
# cook your dish here
def find_lcm(num1, num2):
 if(num1>num2): 
  num = num1 
  den = num2 
 else: 
  num = num2 
  den = num1 
 rem = num % den 
 while(rem != 0): 
  num = den 
  den = rem 
  rem = num % den 
 gcd = den 
 lcm = int(int(num1 * num2)/int(gcd)) 
 return lcm

for _ in range(int(input())):
 n=int(input())
 x=list(map(int,input().split()))
 num1 = x[0] 
 num2 = x[1] 
 lcm = find_lcm(num1, num2)
 lcm = find_lcm(lcm, x[2])
 n=n*24
 print(int(n/lcm))


# cook your dish here
def find_lcm(num1, num2):
 if(num1>num2): 
  num = num1 
  den = num2 
 else: 
  num = num2 
  den = num1 
 rem = num % den 
 while(rem != 0): 
  num = den 
  den = rem 
  rem = num % den 
 gcd = den 
 lcm = int(int(num1 * num2)/int(gcd)) 
 return lcm

for _ in range(int(input())):
 n=int(input())
 x=list(map(int,input().split()))
 num1 = x[0] 
 num2 = x[1] 
 lcm = find_lcm(num1, num2)
 lcm = find_lcm(lcm, x[2])
 n=n*24
 print(int(n/lcm))

