Four Multiples


How many integers in [1,n][1, n] are divisible by at least one of the four positive integers aa, bb, cc, and dd?

Print the exact count (not modulo anything).

Input

A single line containing five integers nn, aa, bb, cc, and dd.

Output

Print one integer: the number of integers in [1,n][1, n] that are divisible by at least one of aa, bb, cc, and dd.

Constraints

  • 1≤n≤10181 \le n \le 10^{18}
  • 1≤a,b,c,d≤1091 \le a, b, c, d \le 10^9

Example 1

Input 1
10 2 3 5 7
Output 1
9
Explanation

The integers in [1,10][1, 10] divisible by 22, 33, 55, or 77 are 2,3,4,5,6,7,8,9,102, 3, 4, 5, 6, 7, 8, 9, 10. Only 11 is missing.

Example 2

Input 2
1 2 3 4 5
Output 2
0
Explanation

The only candidate is 11, and none of 2,3,4,52, 3, 4, 5 divide 11.

Example 3

Input 3
100 2 2 2 2
Output 3
50
Explanation

All four moduli are 22, so the answer is the number of even integers in [1,100][1, 100].

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.