#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 70;
const int INF = 2.1e9;
const int MOD = 1e9 + 7;
const double eps = 1e-7;
const double PI = acos(-1.0);
int n, m, k;
char s[maxn];
int op[maxn], val[maxn], last[maxn];
long long cur[maxn];
bool flag[maxn];
long long fun() {
  long long x = 0, MX = 1LL << 32;
  int cnt = 0;
  cur[0] = 1;
  flag[0] = 1;
  last[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (op[i] == 0) {
      cur[i] = cur[i - 1];
      flag[i] = flag[i - 1];
      if (!flag[i]) return -1;
      x += cur[i];
      if (x >= MX) return -1;
    } else if (op[i] == 1) {
      cur[i] = cur[last[cnt]] * val[i];
      if (cur[i] >= MX || !flag[last[cnt]])
        flag[i] = 0;
      else
        flag[i] = 1;
      ++cnt;
      last[cnt] = i;
    } else {
      --cnt;
      cur[i] = cur[last[cnt]];
      flag[i] = flag[last[cnt]];
    }
  }
  return x;
}
int main() {
  while (cin >> n) {
    for (int i = 1; i <= n; i++) {
      scanf("%s", s);
      if (s[0] == 'a')
        op[i] = 0;
      else if (s[0] == 'f') {
        op[i] = 1;
        scanf("%d", &val[i]);
      } else
        op[i] = 2;
    }
    long long ans = fun();
    if (ans == -1)
      cout << "OVERFLOW!!!" << endl;
    else
      cout << ans << endl;
  }
  return 0;
}
