#include <bits/stdc++.h>
using namespace std;
const long long INF = 1ll << 32;
int main() {
  long long t;
  cin >> t;
  int flag = 0;
  long long ans = 0;
  long long multi = 1;
  stack<long long> ss;
  ss.push(1);
  for (int i = 0; i < t; ++i) {
    string s;
    cin >> s;
    if (s.compare("add") == 0) {
      ans += min(ss.top(), INF);
    }
    if (s.compare("for") == 0) {
      long long a;
      cin >> a;
      ss.push(min(a * ss.top(), INF));
    }
    if (s.compare("end") == 0) {
      ss.pop();
    }
    if (ans >= INF) {
      flag = 1;
    }
  }
  if (ans >= INF || flag == 1) {
    cout << "OVERFLOW!!!" << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}
