import math t, a, b = map(int, input().split()) g = math.gcd(a, b) ans = (t - 1) // a + 1 + (t - 1) // b + 1 - (t - 1) // (a // g * b) - 1 print(ans)