#include <stdio.h> #include <string.h> int shi(char a[],char b[],char arr[][11]){ int sum; for(int i=0;i<10;i++){ if(strcmp(a,arr[i])==0)sum=i; } for(int i=0;i<10;i++){ if(strcmp(b,arr[i])==0)sum=sum*10+i; } return sum; } int ge(char a[],char arr[][11]){ int sum; for(int i=0;i<10;i++){ if(strcmp(a,arr[i])==0)sum=i; } return sum; } int main(){ char arr[11][11]={"zero","one","two","three","four","five","six","seven","eight","nine"}; char a[10],a1[10],b[10],b1[10];int m,n; while(scanf("%s %s",a,a1)!=EOF){ if(strcmp(a1,"+")==0){ m=ge(a,arr); scanf("%s %s",b,b1); if(strcmp(b1,"=")==0) n=ge(b,arr); else { n=shi(b,b1,arr); scanf("%s",b1); } } else { m=shi(a,a1,arr); scanf("%s %s %s",a1,b,b1); if(strcmp(b1,"=")==0) n=ge(b,arr); else { n=shi(b,b1,arr); scanf("%s",b1); } } if(m+n==0)break; printf("%d\n",m+n); } return 0; }