#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, two = 1;
  for (long long i = 0; i < 32; ++i) two *= 2;
  cin >> n;
  stack<long long> st;
  long long ans = 0, cur = 1, more = -1, more_val = 0;
  bool overflow = false;
  for (long long i = 0; i < n; ++i) {
    string s;
    cin >> s;
    if (s == "add") {
      if (more >= 0 || cur > two - 1 - ans) overflow = true;
      ans += cur;
    } else if (s == "end") {
      if (more >= 0 && st.size() - 1 == more) {
        more = -1;
        cur = more_val;
      }
      cur /= st.top();
      st.pop();
    } else {
      long long x;
      cin >> x;
      st.push(x);
      cur *= x;
      if (cur > two && more == -1) {
        more = st.size() - 1;
        more_val = cur;
      }
    }
  }
  if (overflow)
    cout << "OVERFLOW!!!";
  else
    cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
