#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const long long MAXN = ((long long)1 << 32) - 1;
pair<long long, long long> a[maxn];
int stk[maxn], top, R[maxn];
long long solve(int l, int r) {
  long long sum = 0;
  for (int i = l; i <= r; i++) {
    if (a[i].first == 1) {
      long long tmp = solve(i + 1, R[i]);
      if (tmp < 0) return -1;
      sum = sum + a[i].second * tmp;
      if (sum > MAXN) return -1;
      i = R[i];
    } else if (a[i].first == 3) {
      sum = sum + 1;
      if (sum > MAXN) return -1;
    }
  }
  return sum;
}
int main() {
  long long l;
  cin >> l;
  for (int i = 1; i <= l; i++) {
    string s;
    cin >> s;
    long long n;
    if (s[0] == 'f') {
      cin >> n;
      a[i] = {1, n};
    } else if (s[0] == 'e') {
      a[i] = {2, 0};
    } else {
      a[i] = {3, 1};
    }
  }
  for (int i = 1; i <= l; i++) {
    if (a[i].first == 1) {
      stk[++top] = i;
    } else if (a[i].first == 2) {
      R[stk[top]] = i;
      top--;
    }
  }
  long long ans = solve(1, l);
  if (ans < 0 || ans > MAXN) {
    cout << "OVERFLOW!!!" << endl;
  } else {
    cout << ans << endl;
  }
}
