import math import sys def input(): return sys.stdin.readline().rstrip('\n') def main(): lcm = math.lcm n = int(input()) a, b, c = map(int, input().split()) ans = n//a+n//b+n//c - n//lcm(a, b) - \ n//lcm(b, c) - n//lcm(a, c) + n//lcm(a, b, c) print(ans) if __name__ == '__main__': main()