#include <bits/stdc++.h>
using namespace std;
stack<long long> sq;
int main() {
  int n;
  long long maxs = 1;
  for (int i = 1; i <= 32; i++) maxs *= 2;
  maxs--;
  long long flag = 0;
  long long unused = 0;
  long long now = 0;
  long long times = 1;
  cin >> n;
  while (n--) {
    if (now > maxs) break;
    string s;
    cin >> s;
    if (s == "add") {
      if (flag == 1) {
        cout << "OVERFLOW!!!" << endl;
        return 0;
      }
      now += times;
    } else if (s == "for") {
      long long d;
      cin >> d;
      if (flag == 1) {
        unused++;
        continue;
      }
      sq.push(d);
      times *= d;
      if (times > maxs) {
        flag = 1;
        unused++;
        times /= sq.top();
        sq.pop();
      }
    } else {
      if (unused != 0) {
        unused--;
        if (unused == 0) {
          flag = 0;
        }
        continue;
      }
      times /= sq.top();
      sq.pop();
    }
  }
  if (now > maxs) {
    cout << "OVERFLOW!!!" << endl;
  } else {
    cout << now << endl;
  }
  return 0;
}
