import math n=int(input()) a,b,c=map(int,input().split()) d = (a*b)//math.gcd(a,b) e = (b*c)//math.gcd(b,c) f = (c*a)//math.gcd(c,a) g = (a*b*c//math.gcd(b,c))//(math.gcd(a,(b*c)//math.gcd(b,c))) print(n//a + n//b + n//c - n//d - n//e - n//f + n//g)