#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
long long t, q = 1;
int main() {
  long long x = 0, ov = 0;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    if (s[0] == 'f') {
      long long w;
      cin >> w;
      if (q * w >= 4294967296 || ov > 0) {
        ov++;
      } else {
        q *= w;
        v.push_back(w);
      }
    } else if (s[0] == 'e') {
      if (ov > 0) {
        ov--;
      } else {
        q = q / v[v.size() - 1];
        v.pop_back();
      }
    } else {
      if (ov > 0 || x + q >= 4294967296) {
        cout << "OVERFLOW!!!";
        return 0;
      }
      x += q;
    }
  }
  cout << x;
  return 0;
}
