data = []
i = 0
readlines.each do |l|
	d = 1
	temp = []
	l.chars do |c|
		if !(c =~ /[0-9]/)
			next if temp.empty?	
			data[i] = temp.map.with_index{|n,i| n*(10**i)}.inject{|x,y| x+y} 
			temp.clear
			i += 1
			data[i] = 0
		else
			temp.unshift(c.to_i)
		end
	end
end
puts data.inject{|x,y| x+y} 