#include <bits/stdc++.h>
const long double pie = 3.1415926535;
using namespace std;
long long fpow(long long n, long long p) {
  long long m = 1;
  while (p) {
    if (p % 2) m *= n;
    p >>= 1;
    n *= n;
  }
  return m;
}
long long mfpow(long long n, long long p, long long M) {
  long long m = 1;
  n %= M;
  while (p) {
    if (p % 2) m = (m * n) % M;
    n = (n * n) % M;
    p >>= 1;
  }
  return m % M;
}
const vector<long long> days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool br1, br2, br;
char ch, ch1, ch2;
long long n, k, x, y, z, mini, maxi, l, ind, ini, sum, t, len, r, w, imini, m;
string s, s1, s2;
stack<pair<long long, bool> > st;
void solve() {
  long long maxim = fpow(2, 32) - 1;
  cin >> x;
  st.push(make_pair(1, 0));
  for (long long i = 0; i < x; i++) {
    cin >> s;
    if (s == "for") {
      cin >> m;
      if (st.top().second == 1 || m * st.top().first > maxim)
        st.push(make_pair(m * st.top().first, 1));
      else
        st.push(make_pair(m * st.top().first, 0));
    }
    if (s == "end") st.pop();
    if (s == "add") {
      n += st.top().first;
      if (st.top().second == 1 || n > maxim) br = 1;
    }
  }
  if (br)
    cout << "OVERFLOW!!!" << endl;
  else
    cout << n << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  solve();
  return 0;
}
