def g(a,b): while b:a,b=b,a%b return a def f(a,b):return a*b//g(a,b) n=int(input());a,b,c=map(int,input().split());d=f(a,b) print(n//a+n//b+n//c -n//f(a,c)-n//f(c,d)-n//d +n//f(d,c))