More than 5 years have passed since last update.
puts readlines.map(&:to_i).sum
Register as a new user and use Qiita more conveniently