def fizzbuzz(n) (1..n).each do |i| if i%15 == 0 puts "FizzBuzz" elsif i%3 == 0 puts "Fizz" elsif i%5 == 0 puts "Buzz" else puts i end end end begin ns = gets.chomp if ns.include?(' ') ab = ns.split.map(&:to_i).inject(:+) s = gets.chomp puts "#{ab} #{s}" exit end N = ns.to_i lines = readlines if lines.size == 0 if N >= 16 fizzbuzz(N) else puts N*(N+1)/2 end elsif lines.size == 1 puts lines[0].split.map(&:to_i).inject(:+) else puts lines.map(&:to_i).inject(:+) end rescue puts "Hello World!" end