from math import lcm N, A, B = map(int, input().split()) t = (N // A) + (N // B) - (N // lcm(A, B)) ans = N - t print(ans)