#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>

using namespace std;

int main(void) {
    while (1) {

        int n;
        cin >> n;
        if (n == 0) break;

        string formula[n];
        int formulalen[n];
        for (int i = 0; i < n; ++i) {
            cin >> formula[i];
            formulalen[i] = formula[i].length();
        }

        while (1) {

            if (formulalen[0] == 1 && formula[0] != "+" && formula[0] != "*") { // 終了条件
                cout << formula[0] << endl;
                break;
            }

            int maxlen = 0;
            for (int i = 0; i < n; ++i) {
                maxlen = max(maxlen, formulalen[i]);
            }

            bool opefind = false;
            long long result = 0;
            string ope;
            int pos = 0;
            int maxcnt = 0;
            for (int i = 0; i < n; ++i) {
                if (formulalen[i] == maxlen) {
                    if (!opefind) {
                        ope = formula[i - 1].substr(formulalen[i - 1] - 1, 1);
//                        result = stoi(formula[i].substr(formulalen[i] - 1));
                        stringstream ss1;
                        ss1 << formula[i].substr(formulalen[i] - 1);
                        ss1 >> result;
//                        cout << result << " ";
                        opefind = true;
                        pos = i - 1;
                        maxcnt += 1;
                    } else {
                        if (ope == "+") {
//                            result += stoi(formula[i].substr(formulalen[i] - 1));
                            int plus;
                            stringstream ss2;
                            ss2 << formula[i].substr(formulalen[i] - 1);
                            ss2 >> plus;
//                            cout << plus << " ";
                            result += plus;
                        } else if (ope == "*") {
//                            result *= stoi(formula[i].substr(formulalen[i] - 1));
                            int mul;
                            stringstream ss3;
//                            cout << formula[i].substr(formulalen[i] - 1) << endl;
                            ss3 << formula[i].substr(formulalen[i] - 1);
                            ss3 >> mul;
//                            cout << mul << endl;
                            result *= mul;
                        }
                        maxcnt += 1;
                    }
                    if (i + 1 != n) {
                        if (formulalen[i + 1] != maxlen) {
                            break;
                        }
                    }
                }
            }

            string replaceformula = "";
            for (int i = 0; i < maxlen - 2; ++i) {
                replaceformula += ".";
            }
            stringstream ss4;
            ss4 << result;
//            replaceformula += to_string(result);
            replaceformula += ss4.str();

            n -= maxcnt;
            formula[pos] = replaceformula;
            for (int i = pos + 1; i < n; ++i) {
                formula[i] = formula[i + maxcnt];
                formulalen[i] = formulalen[i + maxcnt];
            }

//            printf("%d %d\n", pos + 1, maxcnt);
//            for (int i = 0; i < n; ++i) {
//                cout << formula[i] << " " << formulalen[i] << endl;
//            }
        }

    }
    return 0;
}


Measured memory_bytes: 3212