p gets.split('').select { |s| /\d/ =~ s }.map(&:to_i).inject(:+)