import math n, a, b = map(int, input().split()) l = math.lcm(a, b) print(n - (n//a + n//b - n//l))