input = gets.to_i a = Array.new(input+1) {|index| index} sum = a.inject(0) { |result, n| result + n} puts sum