#include #include using namespace std; int main(){ char v[101]; int s=0,x=0,y=1,p=1,i,n; while(!cin.eof()){ cin.get(v,101); cin.get(); if(v[0]=='u') p=9; else p=0; switch(v[p]){ case 'i': p=4; break; case 's': p=2; break; case 'c': p=1; break; } n=strlen(v); for(i=4;i<=n;i++){ if(v[i]=='['){ while(v[++i]!=']') x=x*10+(v[i]-'0'); y*=x; x=0; } if(v[i]==',' || v[i]=='\n' || v[i]==0){ s+=y; y=1; } s*=p; } cout<