#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long ans = 0, j = 1;
  bool poss = 1;
  stack<long long> s;
  for (long long i = 0; i < n; i++) {
    string command;
    cin >> command;
    if (command == "add") {
      ans += j;
      if (ans > 4294967295) {
        poss = 0;
      }
    } else if (command == "end") {
      j = s.top();
      s.pop();
    } else {
      long long k;
      cin >> k;
      s.push(j);
      j *= k;
      if (j > 4294967295) j = 4294967295 + 1;
    }
  }
  if (!poss)
    cout << "OVERFLOW!!!" << endl;
  else
    cout << ans << endl;
  return 0;
}
