import fractions def lcm(x, y): return x * y / fractions.gcd(x , y) n = input() a,b,c = map(int, raw_input().split()) ans = n/a + n/b + n/c - n/lcm(a, b) - n/lcm(b, c) - n/lcm(a, c) + n/lcm(a,lcm(b,c)) print ans