import math N,a,b=map(int, input().split()) min_ab=a*b//math.gcd(a,b) a_times=N//a b_times=N//b ab_times=(N//min_ab) ans=a_times+b_times-ab_times+1 if N%min_ab==0: print(ans-1) else: print(ans)