import math t, a, b = [int(i) for i in input().split()] ans = math.floor((t - 1) / a) + 1 + math.floor((t - 1) / b) + 1 - (math.floor((t - 1) / (a * b / math.gcd(a, b))) + 1) print(ans)