#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long T, t;
void solve() {
  long long int i, n, cnt = 0, a, sum2 = 0, ans = 1, x = 0, k, bound;
  stack<long long int> s;
  cin >> n;
  ans = 1;
  string st;
  bound = (pow(2, 32) - 1);
  for (i = 0; i < n; i++) {
    cin >> st;
    if (st == "for") {
      cin >> a;
      if (cnt > 0 || x + ans * a > bound) {
        cnt++;
      } else {
        ans *= a;
        s.push(a);
      }
    } else if (st == "end") {
      if (cnt > 0)
        cnt--;
      else {
        ans /= s.top();
        s.pop();
      }
    } else {
      if (x + ans > bound || cnt > 0) {
        cout << "OVERFLOW!!!";
        return;
      }
      x += ans;
    }
  }
  if (x > bound)
    cout << "OVERFLOW!!!";
  else
    cout << x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  t = 1;
  while (t--) solve();
  return 0;
}
