#include <iostream>
#include <cstdio>
#include <vector>
#include <string>

using namespace std;

int rec(vector<string> s, int top, int bot, int lev) {
    if (s[top][lev] >= '0' && s[top][lev] <= '9') return s[top][lev]-'0';
    
    vector<int> a;
    int y = top;
    int x = lev+1;
    while (y+1 <= bot && x < s[y+1].size() && s[y+1][x] != ' ') {
        y++;
        if (s[y][x] >= '0' && s[y][x] <= '9') {
            a.push_back(s[y][x]-'0');
        }
        else if (s[y][x] == '+' || s[y][x] == '*') {
            int b = y;
            while (b+1 <= bot && s[b+1][x] == '.') b++;
            a.push_back(rec(s,y,b,x));
            y = b;
        }
    }
    
    //printf("top=%d bot=%d lev=%d | ",top,bot,lev);
    //for (int i = 0; i < a.size(); i++) cout << a[i] << " "; cout << endl;
    
    int sum = 0;
    if (s[top][lev] == '+') for (int i = 0; i < a.size(); i++) sum += a[i];
    else if (s[top][lev] == '*') {
        sum = 1;
        for (int i = 0; i < a.size(); i++) sum *= a[i];
    }
    return sum;
}

int main(void){
    int n;
    while (cin>>n && n) {
        vector<string> s(n);
        for (int i = 0; i < n; i++) cin >> s[i];
        cout << rec(s, 0, n-1, 0) << endl;
    }
}