#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
bool isPowerOfTwo(long long int x) { return x && (!(x & (x - 1))); }
long long int Modular_Exponentiation(long long int x, long long int n,
                                     long long int M) {
  if (n == 0) return 1;
  if (n % 2)
    return (x * Modular_Exponentiation((x * x) % M, n / 2, M)) % M;
  else
    return (Modular_Exponentiation((x * x) % M, n / 2, M)) % M;
}
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i += 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
void solve() {
  long long int c = (1LL << 32) - 1;
  long long int l;
  cin >> l;
  stack<long long int> stk;
  long long int ans = 0;
  for (long long int i = 0; i < l; ++i) {
    string str;
    cin >> str;
    if (str == "add") {
      if (stk.empty())
        ans++;
      else
        ans += (stk.top());
    } else {
      if (str == "for") {
        long long int n;
        cin >> n;
        if (!stk.empty()) n = n * stk.top();
        stk.push(min(c + 1, n));
      } else {
        if (stk.empty()) {
          cout << "OVERFLOW!!!\n";
          return;
        }
        stk.pop();
      }
    }
    if (ans > c) {
      cout << "OVERFLOW!!!\n";
      return;
    }
  }
  if (ans > c) {
    cout << "OVERFLOW!!!\n";
    return;
  }
  cout << ans;
}
int32_t main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) solve();
  cerr << "Time taken : " << fixed << setprecision(5)
       << ((float)clock() / CLOCKS_PER_SEC) * 1000 << " ms"
       << "\n";
  cerr << "My CLOCKS_PER_SEC= " << CLOCKS_PER_SEC << "\n";
  return 0;
}
