#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const long long int big = 2999999999999999999;
const long long int small = -2999999999999999999;
void in2(long long int& a, long long int& b) {
  scanf("%lld", &a);
  scanf("%lld", &b);
}
void in3(long long int& a, long long int& b, long long int& c) {
  scanf("%lld", &a);
  scanf("%lld", &b);
  scanf("%lld", &c);
}
void swap(long long int& a, long long int& b) {
  a = a + b;
  b = a - b;
  a = a - b;
}
void arrayIn(vector<long long int>& a, long long int& n) {
  for (long long int i = 0; i < n; i++) scanf("%lld", &a[i]);
}
const string add = "add";
const string loop = "for";
const string end = "end";
void solve() {
  long long int x = 0;
  long long int l;
  cin >> l;
  string s;
  stack<long long int> fo;
  long long int prod = 1;
  vector<long long int> prods;
  long long int p;
  bool done = false;
  long long int maxi = (1ll << 32) - 1;
  for (long long int i = 0; i < l; i++) {
    cin >> s;
    if (s == loop) cin >> p;
    if (!done) {
      if (s == add) {
        x += prod;
        if (prods.size() > 0 || x > maxi) {
          cout << "OVERFLOW!!!";
          done = true;
        }
      } else if (s == loop) {
        if (prod * p > maxi) {
          prods.push_back(prod);
          prod = p;
        } else
          prod *= p;
        fo.push(p);
      } else {
        prod /= fo.top();
        if (prod == 1 && prods.size() > 0) {
          prod = prods.back();
          prods.erase(prods.end() - 1);
        }
        fo.pop();
      }
    }
  }
  if (!done) cout << x;
}
int main() { solve(); }
