import math N, A, B = map(int, input().split()) lcm = A * B // math.gcd(A, B) count_A = N // A + 1 count_B = N // B + 1 count_AB = N // lcm + 1 bad = count_A + count_B - count_AB answer = N + 1 - bad print(answer)