#include <bits/stdc++.h>
using namespace std;
ifstream f1;
ofstream f2;
const long long ma = (1ll << 32);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  f1.open("INP.txt");
  f2.open("OUT.txt");
  long long n;
  cin >> n;
  stack<long long> next;
  next.push(1);
  long long cur = 0;
  for (long long i = 0; i < n; i++) {
    string task;
    cin >> task;
    if (task == "add") {
      cur += next.top();
    } else if (task == "for") {
      long long val;
      cin >> val;
      next.push(min(ma, val * next.top()));
    } else {
      next.pop();
    }
  }
  if (cur >= ma) {
    cout << "OVERFLOW!!!" << endl;
  } else {
    cout << cur << endl;
  }
  return 0;
}
