from math import lcm N, A, B = map(int, input().split()) def func(n, A, B): return n//A+n//B-n//lcm(A, B) print(N-func(N, A, B))