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