refactor sum.rb