#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int inf = 1e9;
const int mod = 1e9 + 7;

int dfs(const vector<string> &s, int i, int j) {
    if (isdigit(s[i][j])) {
        return s[i][j] - '0';
    }

    int ret = (s[i][j] == '+' ? 0 : 1);
    int nj = j + 1;
    rep2(ni, i + 1, s.size()) {
        if (nj >= s[ni].size()) break;
        if (s[ni][nj] == '.') continue;
        if (s[i][j] == '+') ret += dfs(s, ni, nj);
        if (s[i][j] == '*') ret *= dfs(s, ni, nj);
    }
    return ret;
}

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int n;
    while (cin >> n, n) {
        vector<string> s(n);
        rep(i, n) cin >> s[i];
        cout << dfs(s, 0, 0) << endl;
    }
}