from math import gcd d=lambda x,y:x*y//gcd(x,y) n=int(input()) a,b,c=map(int,input().split()) e=d(a,b) print(n//a+n//b+n//c+n//d(e,c)-n//e-n//d(a,c)-n//d(c,b))