import sys import math input = lambda: sys.stdin.readline().rstrip() def solve(): n, a, b = map(int, input().split()) lcm = (a*b)//math.gcd(a, b) ans = n - (n//a + n//b) + n//lcm print(ans) t = 1 # t = int(input()) for _ in range(t): solve()