import math n = int(input()) a,b,c=map(int,input().split()) # inc exc pol # a + b + c - ab - ac - bc + abc A,B,C = n//a, n//b,n//c AB,AC,BC = n//math.lcm(a,b), n//math.lcm(a,c), n//math.lcm(b,c) ABC = n//math.lcm(a, math.lcm(b,c)) print(A+B+C-AB-AC-BC+ABC)