import math N, A, B = list(map(int, input().split())) def baisuu(N, A): return N // A a = baisuu(N, A) b = baisuu(N, B) ab = baisuu(N, math.lcm(A, B)) print(N - a - b + ab)