#include <bits/stdc++.h>
using namespace std;
long long n, st[100005], tot = 0;
char s[100];
long long S = 1, ans = 0, u = ((1ll << 32) - 1ll);
inline void filehandling() {}
int main() {
  filehandling();
  scanf("%d", &n);
  st[0] = 1;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%s", s);
    if (s[0] == 'f') {
      scanf("%d", &x);
      S = min(u + 1, st[tot] * x);
      st[++tot] = S;
    } else if (s[0] == 'a') {
      if (ans + st[tot] > u) {
        printf("OVERFLOW!!!");
        return 0;
      } else
        ans = ans + st[tot];
    } else
      tot--;
  }
  printf("%I64d", ans);
  return 0;
}
