imput1 = gets.to_i imput2 = gets.split.map(&:to_i) i = 0 sum = 0 until i > imput1 i = i + 1 if i % imput2[0] == 0 sum = sum + 1 elsif i % imput2[1] == 0 sum = sum + 1 elsif i % imput2[2] === 0 sum = sum + 1 else end end p sum