class PockyGame attr_reader :l, :k def initialize(l: 0, k: 0) @l, @k = l, k end def datainput begin @l, @k = gets.chomp.split.map { |v| Integer(v) } rescue end end def pockygame(pocky_length, once_length) cnt = 0 loop do break if pocky_length <= (once_length*2*cnt) cnt += 1 end once_length*(cnt-1) end def dataoutput puts pockygame(@l, @k) end def run datainput dataoutput end end if $0 == __FILE__ PockyGame.new.run end