#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int max = 4294967296, x = 0;
  stack<long long int> s;
  s.push(1);
  int l, n = 0;
  char command[4];
  scanf("%d\n", &l);
  while (l--) {
    scanf("%s", command);
    if (command[0] == 'f') {
      scanf("%d", &n);
      if (s.top() * n < max)
        s.push(n * s.top());
      else
        s.push(max);
    } else if (command[0] == 'a') {
      x += s.top();
      if (x >= max) break;
    } else if (command[0] == 'e') {
      s.pop();
    }
  }
  if (x < max)
    printf("%lld\n", x);
  else
    printf("OVERFLOW!!!\n");
  return 0;
}
