#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
/*收集处理 “ + ” 前的数 与  “ = ” 前的数
	然后对两数相加即可
*/
int main() {
    string a;
    map<string, int> map;
    vector<int> temp;
    map["one"] = 1;
    map["two"] = 2;
    map["three"] = 3;
    map["four"] = 4;
    map["five"] = 5;
    map["six"] = 6 ;
    map["seven"] = 7 ;
    map["eight"] = 8;
    map["nine"] = 9 ;
    map["zero"] = 0 ;
    int A = 0;
    while (cin >> a ) { // 注意 while 处理多个 case

        if (a == "+") {
            for (int j = temp.size() - 1, i = 0; j >=0 ; j--, i++) {
                A += pow(10, i) * temp[j];
                temp.pop_back();
            }
            // cout << A  << endl;
            temp.push_back(A);
            A = 0;
        } else if (a == "=") {
            for (int j = temp.size() - 1,i=0; j >= 1; j--,i++) {
                A += pow(10, i) * temp[j];
                temp.pop_back();
            }
            if(A==0&&temp[0]==0){
                return 0;
            }
            cout << A  + temp[0] << endl;
            temp.pop_back();
            A = 0;
        } else if(a==" "){
            
        }else {
            temp.push_back(map[a]);
        }

    }
}
// 64 位输出请用 printf("%lld")