N=input() (A,B,C)=map(int,raw_input().split()) def gcd(p,q):return p if q == 0 else gcd(q,p % q) def lcm(p,q):return p/gcd(p,q)*q print N/A+N/B+N/C-N/lcm(A,B)-N/lcm(B,C)-N/lcm(C,A)+N/lcm(lcm(A,B),C)