#include <bits/stdc++.h>
using namespace std;
const long long MAX = 4294967295;
int main() {
  int l;
  string in;
  long long val = 0;
  cin >> l;
  long long x = 0;
  stack<long long> fors;
  for (int i = 0; i < l; i++) {
    cin >> in;
    if (in == "for") {
      cin >> val;
      long long curr = val;
      if (!fors.empty()) {
        if (fors.top() == -1) {
          curr = -1;
        } else {
          curr *= fors.top();
        }
      }
      if (curr > MAX) {
        curr = -1;
      }
      fors.push(curr);
    }
    if (in == "end") {
      fors.pop();
    }
    if (in == "add") {
      if (fors.empty()) {
        x++;
      } else {
        if (fors.top() == -1) {
          cout << "OVERFLOW!!!";
          return 0;
        }
        x += fors.top();
      }
      if (x > MAX) {
        cout << "OVERFLOW!!!";
        return 0;
      }
    }
  }
  cout << x;
  return 0;
}
