import math N, A, B = map(int, input().split()) print(N - N // B if B % A == 0 else N - N // A - N // B + N * math.gcd(A, B) // (A * B))