#include<iostream>
#include<string>
#include<map>
using namespace std; map<string ,int> mp; void setMap()
{
mp["zero"] = ;
mp["one"] = ;
mp["two"] = ;
mp["three"] = ;
mp["four"] = ;
mp["five"] = ;
mp["six"] = ;
mp["seven"] = ;
mp["eight"] = ;
mp["nine"] = ;
}
int main ()
{
setMap ();
int sum;
string a,b;
string filter;
while(cin>>a)
{
sum=;
cin>>b;
if(b!="+")
{
sum+=mp[a]*+mp[b];
cin>>filter;
}
else
{
sum+=mp[a];
}
cin>>a>>b;
if(b!="=")
{
sum+=mp[a]*+mp[b];
cin>>filter;
}
else
{
sum+=mp[a];
}
if(sum == )
{
break;
}
else
{
cout<<sum<<endl;
}
}
return ;
}