def fun(a, l): larr = [] rarr = [] c=0 k=0 m = int(l/2) op = a[m] for i in a: c+=1 if c > m: rarr.append(i) elif c<m: larr.append(i) dig = ['zero','one' , 'two' ,'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'] for i in range(len(rarr)): for k in range(len(dig)): if i < len(rarr): if rarr[i] == dig[k]: rarr[i] = k if i < len(larr): if larr[i] == dig[k]: larr[i] = k #prit() return rarr, larr def fun2(a, b): m = len(a)-1 m1 = len(b)-1 e=0 f = 0 for i in a: if m < 0: break e += i*(10**m) m-=1 for i in b: if m1 < 0: break f += i*(10**m1) m1-=1 return e, f def add(a, l): r, l = fun(a, l) r.pop() res1, res2=fun2(r, l) res = res1+res2 print(res) while True: try: s = input().split() if s[0] == 'zero' and s[2] == 'zero': break a = len(s) add(s, a) except: break