import math def lcm(x, y): return (x*y)//math.gcd(x, y) T, A, B = map(int, input().split()) T -= 1 ans = T//A + T//B + 1 ans -= T//lcm(A, B) print(int(ans))