from math import * n=int(input()) a,b,c=map(int,input().split()) print(n//a+n//b+n//c-n//lcm(a, b)-n//lcm(b,c)-n//lcm(c,a)+n//lcm(a,b,c))