#include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;

int n;
vector<string> s;

ll dfs(int x,int y) {
  if( '0' <= s[y][x] && s[y][x] <= '9' ) {
    return (ll)(s[y][x]-'0');
  }
  assert( s[y][x] == '*' || s[y][x] == '+' );
  char op = s[y][x];
  ll ret = ( (op=='*') ? 1 : 0 );
  ++y, ++x;
  while( y < n && x < (int)s[y].size() ) {
    if( '0' <= s[y][x] && s[y][x] <= '9' ) {
      if( op == '*' ) ret *= (ll)(s[y][x]-'0');
      else            ret += (ll)(s[y][x]-'0');
      ++y;
    } else {
      if( op == '*' ) ret *= dfs(x,y);
      else            ret += dfs(x,y);
      ++y;
      while( y < n && x < (int)s[y].size() && s[y][x] == '.' ) ++y;
    }
  }
  return ret;
}

int main() {
  while( cin >> n,n ) {
    s.clear();
    s.resize(n);
    rep(i,n) cin >> s[i];
    cout << dfs(0,0) << endl;
  }
  return 0;
}