#coding: utf-8 ##yuki_316 def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd (a, b) n=int(raw_input()) a,b,c=map(int,raw_input().split()) x=n/a+n/b+n/c y=n/lcm(a,b)+n/lcm(b,c)+n/lcm(c,a) z=n/lcm(a,lcm(b,c)) print x-y+z