#include <bits/stdc++.h>
using namespace std;
int main() {
  int L, n;
  unsigned long long val = 0, outer = 0;
  string str;
  bool ended = false;
  stack<int> Loop;
  vector<unsigned long long> Value;
  cin >> L;
  while (L-- && !ended) {
    cin >> str;
    if (str[0] == 'a') {
      if (Loop.size() > 0) {
        (Value)[((Value).size()) - 1]++;
        if (outer + (Value)[((Value).size()) - 1] > 4294967295) {
          ended = true;
          break;
        }
      } else {
        outer++;
        if (outer > 4294967295) {
          ended = true;
          break;
        }
      }
    }
    if (str[0] == 'f') {
      cin >> n;
      Loop.push(n);
      (Value).push_back((0));
    }
    if (str[0] == 'e') {
      n = Loop.top();
      Loop.pop();
      val = (Value)[((Value).size()) - 1];
      Value.pop_back();
      if (Value.size() > 0) {
        (Value)[((Value).size()) - 1] += n * val;
        if (outer + (Value)[((Value).size()) - 1] > 4294967295) {
          ended = true;
          break;
        }
      } else {
        outer += n * val;
        if (outer > 4294967295) {
          ended = true;
          break;
        }
      }
    }
  }
  if (ended) {
    cout << "OVERFLOW!!!";
  } else {
    cout << outer;
  }
  return 0;
}
