#include <bits/stdc++.h>
using namespace std;
const long long MAXN = (1LL << 32) - 1;
int com;
long long x;
string s;
stack<long long> cur;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> com;
  x = 0LL;
  long long mult = 1LL;
  long long y;
  int pend = 0;
  while (com--) {
    cin >> s;
    if (s[0] == 'f') {
      cin >> y;
      if (pend <= 0) mult *= y;
      if (mult > MAXN) pend++;
      cur.push(y);
    } else if (s[0] == 'e') {
      if (pend <= 1) mult /= cur.top();
      cur.pop();
      pend = max(0, pend - 1);
    } else {
      x += mult;
      if (x > MAXN) {
        cout << "OVERFLOW!!!\n";
        return 0;
      }
    }
  }
  cout << x << endl;
  return 0;
}
