def lscan; gets.split.map(&:to_i); end t, a, b = lscan t -= 1 p t/a + t/b - t/(a.lcm(b)) + 1