local function getgcd(x, y) while 0 < x do x, y = y % x, x end return y end local t = 0LL + io.read("*n") local a = 0LL + io.read("*n") local b = 0LL + io.read("*n") local ra = (t - 1) / a + 1 local rb = (t - 1) / b + 1 local gcd = getgcd(a, b) local rc = ((t - 1) / a) / (b / gcd) + 1 local str = tostring(ra + rb - rc):gsub("LL", "") print(str)