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

string S[30];
int pos, n;
int Rank[30];

int Add(int);
int Multi(int);

int main(){
	int ans;
	while(cin>>n && n){
		for(int i=0;i<n;i++){
			cin>>S[i];
			Rank[i]=S[i].length()-1;
		}

		if('0'<=S[0][0] && S[0][0]<='9'){
			cout<<S[0][0]<<endl;
			continue;
		}else{
			pos=1;
			if(S[0][0]=='+'){
				ans=Add(0);
			}else if(S[0][0]=='*'){
				ans=Multi(0);
			}

			cout<<ans<<endl;
		}

	}

	return 0;
}

int Add(int R){
	int ret=0;
	while(pos<n){
		if(Rank[pos]<=R)break;

		char ch=S[pos][ Rank[pos] ];
		if('0'<=ch && ch<='9'){
			ret+=(ch-'0');
			pos++;
		}else{
			pos++;
			if(ch=='+'){
				ret+=Add(Rank[pos-1]);
			}else if(ch=='*'){
				ret+=Multi(Rank[pos-1]);
			}
		}
	}

	return ret;
}

int Multi(int R){
	int ret=1;
	while(pos<n){
		if(Rank[pos]<=R)break;

		char ch=S[pos][ Rank[pos] ];
		if('0'<=ch && ch<='9'){
			ret*=(ch-'0');
			pos++;
		}else{
			pos++;
			if(ch=='+'){
				ret*=Add(Rank[pos-1]);
			}else if(ch=='*'){
				ret*=Multi(Rank[pos-1]);
			}
		}
	}

	return ret;
}

