#include <bits/stdc++.h>
using namespace std;
const long long MOD = (1LL << 32) - 1;
int n;
char op[20];
long long ans, now;
stack<int> sta;
int main() {
  scanf("%d", &n);
  now = 1;
  bool flag = false;
  int stat = -1;
  int deep = 0;
  while (n--) {
    scanf("%s", op);
    if (op[0] == 'a') {
      if (flag) {
        ans = MOD + 1;
        break;
      }
      ans = (ans + now);
      if (ans > MOD) {
        break;
      }
    } else if (op[0] == 'f') {
      ++deep;
      int k;
      scanf("%d", &k);
      if (!flag) {
        now = now * k;
        if (now > MOD) {
          stat = deep;
          flag = true;
        }
        sta.push(k);
      }
    } else {
      if (flag && deep == stat) {
        stat = -1;
        flag = false;
      }
      --deep;
      if (!flag) {
        int top = sta.top();
        sta.pop();
        now /= top;
      }
    }
  }
  if (ans > MOD) {
    printf("OVERFLOW!!!");
  } else {
    printf("%lld", ans);
  }
  return 0;
}
