#include <bits/stdc++.h>
using namespace std;
const int md = 3e5 + 100;
vector<int> st;
vector<int> prp;
int main() {
  int l;
  cin >> l;
  long long cur = 0;
  while (l--) {
    string ord;
    cin >> ord;
    if (ord == "for") {
      long long x;
      cin >> x;
      prp.push_back(x);
      if (x > 1) {
        st.push_back(x);
      }
    } else if (ord == "end") {
      long long x = prp[prp.size() - 1];
      prp.pop_back();
      if (x > 1) st.pop_back();
    } else {
      if ((int)st.size() > 32) {
        puts("OVERFLOW!!!");
        return 0;
      } else {
        long long prev = 1;
        for (auto p : st) {
          prev = prev * p;
          if (prev >= (1ll << 32)) {
            puts("OVERFLOW!!!");
            return 0;
          }
        }
        cur += prev;
      }
    }
    if (cur >= (1ll << 32)) {
      puts("OVERFLOW!!!");
      return 0;
    }
  }
  cout << cur;
  return 0;
}
