import math n = int(input()) a,b,c = map(int,input().split()) s, x, y, z = 0, 1, 1, 1 ab = math.lcm(a,b) bc = math.lcm(b,c) ca = math.lcm(c,a) abc = math.lcm(a,b,c) if a%b and a%c: s += (n//a) else: x = 0 if b%a and b%c: s += (n//b) else: y = 0 if c%a and c%b: s += (n//c) else: z = 0 print(s) if x and y: s -= (n//ab) if y and z: s -= (n//bc) if z and x: s -= (n//ca) print(s) if x and y and z: s += (n//abc) print(s)