class Yukicoder def initialize n = gets.to_i a, b, c = gets.chomp.split.map(&:to_i) puts n/a + n/b + n/c - n/a.lcm(b) - n/b.lcm(c) - n/a.lcm(c) + n/[a,b,c].inject(&:lcm) end end Yukicoder.new