ones, fives = gets.chomp.split.map(&:to_i) list ,sum = Array.new, 0 1.upto(ones){ |one| list << sum += 1 } sum = 0 1.upto(fives){ |five| list << sum += 5 1.upto(ones){ |one| list << sum += 1 } } puts list.uniq