from math import gcd T, A, B = map(int, input().split()) T -= 1 lcm = A * B // gcd(A, B) print((T // A + 1) + (T // B + 1) - (T // lcm + 1))