import math N, A, B = map(int,input().split()) ans = N ans -= N // A ans -= N // B X = A * B // math.gcd(A, B) ans += N // X print(ans)