#include <bits/stdc++.h>
const int MOD = (int)1e9 + 7;
using namespace std;
stack<long long> st;
int main() {
  long long n, num;
  cin >> n;
  long long sum = 0;
  int over = 0;
  st.push(1);
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    if (over == 1) continue;
    if (s[0] == 'a') {
      sum += st.top();
      if (sum > 4294967295) {
        over = 1;
      }
    } else if (s[0] == 'f') {
      cin >> num;
      long long f = st.top();
      if (st.top() > 4294967295)
        st.push(st.top());
      else
        st.push(f * num);
    } else {
      st.pop();
    }
  }
  if (over == 1)
    cout << "OVERFLOW!!!" << endl;
  else
    cout << sum << endl;
  return 0;
}
