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 = pocky_length / (once_length * 2) cnt -= 1 if pocky_length % (once_length * 2) == 0 once_length * cnt end def dataoutput puts pockygame(@l, @k) end def run datainput dataoutput end end if $0 == __FILE__ PockyGame.new.run end