import sys import re sum = 0 for line in sys.stdin: line = re.sub(r'[^\d]', '', line) first = line[0] last = line[-1] value = int(first + last) sum += value print(sum)