class No405 attr_accessor :list, :time, :count, :start_time, :end_time def initialize self.time, self.count = gets.split.map(&:to_s) self.list = ["I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"] for i in 0...self.list.size do self.start_time = i if self.time == self.list[i] end self.end_time = self.start_time + self.count.to_i end def twenty_four_more_end_time end_time while self.end_time >= 12 self.end_time -= 12 end end def end_time_calc if self.end_time >= 24 twenty_four_more_end_time end_time elsif self.end_time < 0 self.end_time *= -1 twenty_four_more_end_time end_time self.end_time *= -1 end end def run end_time_calc puts end_time >= 12 ? list[end_time - 12] : list[end_time] end end no405 = No405.new no405.run