#include <bits/stdc++.h>
using namespace std;
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr.tie(NULL);
}
int main() {
  fast();
  unsigned long long over = pow(2, 32);
  string s;
  int i;
  unsigned long long num = 0;
  stack<unsigned long long> loop;
  loop.push(1);
  int n;
  cin >> n;
  while (n--) {
    cin >> s;
    if (s == "add") {
      num += loop.top();
      if (num >= over) {
        cout << "OVERFLOW!!!";
        return 0;
      }
    } else if (s == "for") {
      cin >> i;
      loop.push(min(over, loop.top() * i));
    } else {
      loop.pop();
    }
  }
  cout << num;
  return 0;
}
