import math N = int(input()) a,b,c = map(int, input().split()) ca = N // a cb = N // b cc = N // c cab = N // (a*b // math.gcd(a,b)) cac = N // (a*c // math.gcd(a,c)) cbc = N // (b*c // math.gcd(b,c)) cabc = N // (a*b*c // math.gcd(a,b,c)) cfb = ca + cb + cc - cab - cac - cbc + cabc print(cfb)