#include <iostream>
#include <string>

	std::string* in;
	int nline;
	int idx;

int calc(int lv = 0, char kind = '+') {
	int ret = 0;
	if(kind == '*') ret = 1;

	while(true){
	//	std::cout << "idx:" << idx << "\n";
		if(idx >= nline) break;

		std::string& cs = in[idx];
		int clv = 0;
		for(std::string::iterator itr = cs.begin(); itr != cs.end() && *itr == '.'; itr++, clv++);
		if(lv != clv) break;
		idx++;

		char cc = cs[lv];
	//	std::cout << "cc:" << cc << "\n";
		int cnum;

		if(cc == '+' || cc == '*'){
			cnum = calc(lv+1, cc);
		}else{
			cnum = cc - '0';
		}

	//	std::cout << "cnum=" << cnum << "\n";

		if(kind == '*') {
			ret *= cnum;
		}else{
			ret += cnum;
		}

	}
	return ret;
}

int main(void) {

	int ret;

	while(true){
		std::cin >> nline;
		if(!nline) break;

		in = new std::string[nline];
		for(int i=0; i<nline; i++) std::cin >> in[i];
		idx = 0;

		std::cout << calc() << "\n";
	}

	return 0;
}