import math T, A, B = map(int, input().split()) T -= 1 print(T // A + T // B - T // (A // math.gcd(A, B) * B) + 1)