N,A,B=map(int,input().split()) def gcd(x,y): if x == 0: return y return gcd(y%x,x) lcm = A * B // gcd(A,B) print(N - N//A - N // B + N // lcm)