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