#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  string instru;
  long long int x = 0, ciclo, inf = 1LL << 32;
  vector<long long int> pila;
  cin >> n;
  pila.push_back(1);
  for (int i = 0; i < n; i++) {
    cin >> instru;
    if (instru == "add") {
      x += pila.back();
    } else if (instru == "for") {
      cin >> ciclo;
      pila.push_back(min(inf, ciclo * pila.back()));
    } else if (instru == "end") {
      pila.pop_back();
    }
  }
  if (x < inf)
    cout << x << "\n";
  else
    cout << "OVERFLOW!!!\n";
  return 0;
}
