#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
const long long Mxn = (1ll << 32) - 1;
int l;
long long res;
int main() {
  scanf("%d", &l);
  static long long stk[N];
  stk[0] = 1ll;
  while (l--) {
    static char ch[21];
    static int h, n;
    scanf("%s", ch + 1);
    switch (ch[1]) {
      case 'f': {
        scanf("%lld", &stk[++h]);
        if (stk[h - 1] == -1)
          stk[h] = -1;
        else if (1ll * stk[h] * stk[h - 1] > Mxn)
          stk[h] = -1;
        else
          stk[h] = stk[h] * stk[h - 1];
        break;
      }
      case 'a': {
        if (res != -1) {
          res += stk[h];
          if (res > Mxn || stk[h] == -1) res = -1;
        }
        break;
      }
      case 'e': {
        h--;
        break;
      }
    }
  }
  if (res == -1)
    puts("OVERFLOW!!!");
  else
    printf("%lld\n", res);
  return 0;
}
