#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  stack<pair<long long int, long long int> > s;
  long long int prod = 1;
  long long int totalAdds = 0;
  int flag = 0;
  int overflow = 0;
  for (int i = 0; i < t; i++) {
    string str;
    cin >> str;
    if (flag == 1) continue;
    if (str == "add") {
      if (overflow || totalAdds + prod >= (1LL << 32)) {
        flag = 1;
      } else {
        totalAdds += prod;
      }
      continue;
    }
    if (str == "for") {
      long long int n;
      scanf("%lld", &n);
      if (!overflow && ((1LL << 32) - 1LL) / n >= prod) {
        prod = prod * n;
      } else {
        overflow = 1;
      }
      s.push(make_pair(n, overflow));
      continue;
    }
    if (str == "end") {
      if (s.top().second == 0) {
        prod = prod / s.top().first;
        s.pop();
      } else {
        s.pop();
        if (s.empty()) {
          overflow = 0;
        } else {
          overflow = s.top().second;
        }
      }
    }
  }
  if (flag || totalAdds >= (1LL << 32)) {
    printf("OVERFLOW!!!\n");
  } else {
    printf("%lld\n", totalAdds);
  }
  return 0;
}
