// ACM-ICPC‘“ΰ—\‘I2008 C. ŒŽ—j“y—j‘fˆφ” #include #include using namespace std; int pos; string t; int calc(){ char c = t[pos++]; if(isdigit(c)) return c - '0'; if(c == '-') return 2 - calc(); int a = calc(); char op = t[pos++]; int b = calc(); pos++; return op == '+' ? max(a,b) : min(a,b); } int main(){ string s; while(cin >> s){ if(s == ".") break; int ans = 0; for(int P=0;P<3;P++){ for(int Q=0;Q<3;Q++){ for(int R=0;R<3;R++){ t = ""; pos = 0; for(int i=0;i