#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
long long mod = 1e9 + 7;
long long fmod(long long b, long long exp) {
  long long res = 1;
  while (exp) {
    if (exp & 1ll) res = (res * b) % mod;
    b = (b * b) % mod;
    exp /= 2ll;
  }
  return res;
}
stack<long long> st;
string second;
int main() {
  int n, m, i, j, k, x, q;
  int t = 1;
  long long cur = 1;
  long long limit = (1ll << 32) - 1;
  long long tot = 0;
  int fl = 0;
  cin >> t;
  while (t--) {
    cin >> second;
    if (second == "for") {
      long long num;
      cin >> num;
      if (cur <= limit) cur *= num;
      st.push(cur);
    } else if (second == "add") {
      if (st.empty())
        tot++;
      else {
        if (st.top() > limit)
          fl = 1;
        else
          tot += st.top();
      }
    } else {
      st.pop();
      if (!st.empty())
        cur = st.top();
      else
        cur = 1;
    }
  }
  if (fl == 1 || tot > limit)
    cout << "OVERFLOW!!!\n";
  else
    cout << tot << "\n";
  return 0;
}
