T,A,B = map(int,input().split()) def gcd(a,b): while True: r = a % b a = b b = r if r == 0: return a C = A * B // gcd(A,B) T -= 1 print(T // A + 1 + T // B + 1 - T // C - 1)