#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int n;

//-1:+ -2:*

int main()
{
	while (cin >> n) {

		if (n == 0)return 0;

		vector<int>v[15];
		int en[15];
		for (int i = 0; i < 15; i++) {
			en[i] = 0;
		}


		string a;
		for (int i = 0; i < n; i++) {
			cin >> a;

			int l = a.length() - 1;
			if (a[l] == '+') {
				if (!v[l + 1].empty()) {
					for (int i = 14; i >= l+1; i--) {
						/*
						for (int j = 0; j < 15; j++) {
							for (int k = 0; k < v[j].size(); k++) {
								cout << v[j][k] << " ";
							}
							cout << endl;
						}
						cout << endl;
						*/

						if (!v[i].empty()) {
							if (en[i - 1] == -1) {
								int num = 0;
								for (int j = 0; j < v[i].size(); j++) {
									num += v[i][j];
								}
								v[i - 1].push_back(num);
							}
							else {
								int num = 1;
								for (int j = 0; j < v[i].size(); j++) {
									num *= v[i][j];
								}
								v[i - 1].push_back(num);
							}

						}
						v[i].erase(v[i].begin(), v[i].end());
					}
				}
				en[l] = -1;
			}
			else if (a[l] == '*') {
				if (!v[l + 1].empty()) {
					for (int i = 14; i >= l + 1; i--) {

						/*
						for (int j = 0; j < 15; j++) {
							for (int k = 0; k < v[j].size(); k++) {
								cout << v[j][k] << " ";
							}
							cout << endl;
						}
						cout << endl;
						*/

						if (!v[i].empty()) {
							if (en[i - 1] == -1) {
								int num = 0;
								for (int j = 0; j < v[i].size(); j++) {
									num += v[i][j];
								}
								v[i - 1].push_back(num);
							}
							else {
								int num = 1;
								for (int j = 0; j < v[i].size(); j++) {
									num *= v[i][j];
								}
								v[i - 1].push_back(num);
							}

						}
						v[i].erase(v[i].begin(), v[i].end());
					}
					
				}
				
				en[l] = 1;
			}
			else {
				v[l].push_back((int)(a[l] - '0'));
			}

		}

		for (int i = 14; i >= 1; i--) {
			/*
			for (int j = 0; j < 15; j++) {
				for (int k = 0; k < v[j].size(); k++) {
					cout << v[j][k] << " ";
				}
				cout << endl;
			}
			cout << endl;
			*/
			
			
			if (!v[i].empty()) {
				/*
				int j = 0;
				while(j < v[i].size()) {
					if (v[i][j] == -1) {
						int num = 0;
						int k = j + 1;
						while (k<v[i].size()) {
							
							cout << "a" << endl;
							if (v[i][k] < 0)break;
							num += v[i][k];
							k++;
						}
						v[i - 1].push_back(num);
						j = k;
					}
					if (v[i][j] == -2) {
						int num = 1;
						int k = j + 1;
						while (k<v[i].size()) {
							cout << "b" << endl;
							if (v[i][k] < 0)break;
							num *= v[i][k];
							k++;
						}
						v[i - 1].push_back(num);
						j = k;
					}
				}
				*/

				
				if (en[i - 1] == -1) {
					int num = 0;
					for (int j = 0; j < v[i].size(); j++) {
						num += v[i][j];
					}
					v[i - 1].push_back(num);
				}
				else {
					int num = 1;
					for (int j = 0; j < v[i].size(); j++) {
						num *= v[i][j];
					}
					v[i - 1].push_back(num);
				}
				
			}
		}
		cout << v[0][0] << endl;
	}



	return 0;
}



Measured memory_bytes: 3080