HP is doing research in mathematics . After doing lots of research, she struck in a problem . She found four numbers n,a, b and c .Now, She wants to know how many number exists which are less than or equal to n and are divisible by a ,b or c .
Input : First line contains 't' denoting numbers of test cases
Next t lines contains 4 integers denoting n,a,b and c separated by space
Output : 't' lines containing the count of the numbers which are divisible a,b,c
Constraints :
\(1 \le t \le 10^5\)
\(1 \le n \le 10^9\)
\(1 \le a,b,c \le 10^5\)
Here n = 15 , a= 2, b=3,c = 5 The number which are divisible by a ,b, or c are 2,3,4,5,6,8,9,10,12,14,15 i.e 11 numbers , so output is 11
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor