i = gets.to_i sum = 0 (1..i).map { gets.to_i }.each { |n| sum += n } puts sum