#include <bits/stdc++.h>
using namespace std;
vector<string>s;

int calc(int a, int b, char c){
    switch (c){
        case '+': return a+b;
        case '*': return a*b;
    }
}

int calc_rec(int depth, int cur){
    char c=s[cur][depth];
    int res=0;
    if(c=='+'||c=='*'){
        int tmp;
        if(c=='*')res=1;
        int cur2=cur+1;
        while(cur2<s.size()&&s[cur2].size()>=depth+2){
            if(s[cur2][depth+1]!='.'){
                tmp=calc_rec(depth+1,cur2);
                res=calc(res,tmp,c);
            }
            cur2++;
        }
    }else res=int(c-'0');
    // printf("char : %c\n",c);
    // printf("return : %d\n",res);
    return res;
}

int main(void){
    while(true){
        int n;
        cin>>n;
        // printf("input\n");
        if(n==0)return 0;
        for(int i=0;i<n;i++){
            string tmp;
            cin >> tmp;
            s.push_back(tmp);
        }
        // printf("s size : %d\n",s.size());
        int res=calc_rec(0,0);
        cout << res << endl;
        if(!s.empty())s.clear();
    }
}
