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