HP and Divisibility of numbers

0

0 votes
Mathematics, Easy, Mathematics, Mathamatics
Problem

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 :

1t105

1n109

1a,b,c105

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

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

Editor Image

?