from math import gcd N = int(input()) A, B, C = map(int, input().split()) def lcm(a, b): return a*b//gcd(a, b) def lcm2(a, b, c): return lcm(lcm(a, b), c) print(N//A+N//B+N//C-N//lcm(A,B)-N//lcm(B,C)-N//lcm(A,C)+N//lcm2(A,B,C))