def gcd(a,b): if b==0 : return a return gcd(b,a%b) a = list(map(int, input().split())) a[0] = a[0]-1 g = gcd(a[1],a[2]) l = a[2]*a[1]/g ans = a[0]/a[1] + a[0]/a[2] - a[0]/l ans = ans+1 print((int)(ans))