#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7fffffff;
const int maxn = 2e6 + 7;
int main() {
  int l;
  while (cin >> l) {
    long long ans = 0;
    stack<long long> FOR, NUM;
    NUM.push(0);
    int flag = 0;
    for (int i = 0; i < l; i++) {
      string op;
      cin >> op;
      if (op[0] == 'a') {
        long long a = NUM.top();
        a++;
        if (a >= (1ll << 32)) {
          flag = 1;
          a = 0;
        }
        NUM.pop();
        NUM.push(a);
      } else if (op[0] == 'f') {
        long long for_n;
        cin >> for_n;
        FOR.push(for_n);
        NUM.push(0);
      } else {
        int for_n = FOR.top();
        FOR.pop();
        long long t_num = for_n * NUM.top();
        NUM.pop();
        t_num += NUM.top();
        if (t_num >= (1ll << 32)) {
          flag = 1;
          t_num = 0;
        }
        NUM.pop();
        NUM.push(t_num);
      }
    }
    if (flag) {
      cout << "OVERFLOW!!!" << endl;
      continue;
    }
    cout << NUM.top() << endl;
  }
  return 0;
}
