#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = pow(2.0, 32);
  long long t, flag, loop = 1, n, sum = 0;
  cin >> t;
  string s;
  stack<int> st;
  flag = 0;
  while (t--) {
    cin >> s;
    if (s == "add") {
      sum += loop;
      if (sum >= ans) flag = 1;
    } else if (s == "end") {
      if (!st.empty()) {
        int k = st.top();
        loop = loop / k;
        st.pop();
      }
    } else {
      cin >> n;
      if (loop >= ans) {
        st.push(1);
      } else
        st.push(n), loop = loop * n;
    }
  }
  if (flag)
    cout << "OVERFLOW!!!" << endl;
  else
    cout << sum << endl;
  return 0;
}
