import re d="zero|one|two|three|four|five|six|seven|eight|nine|\\d)" def f(l,p): m=re.search(p,l)[1];return str(d.split("|").index(m)) if m in d else m print(sum(map(lambda l:int(f(l,f"({d}.*")+f(l,".*("+d)),open(0).readlines())))