import math a,b,c=(int(x) for x in input().split()) print((a-1)//b+(a-1)//c-(a-1)//(b*c//math.gcd(b,c))+1)