#include <bits/stdc++.h>
template <typename T>
inline void read(T& x) {
  T res = 0, flag = 1;
  char ch;
  ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    res = res * 10 + ch - 48;
    ch = getchar();
  }
  x = res * flag;
}
const long long INF = 1LL << 32;
int l;
long long ans, x;
char buf[10];
std::stack<long long> s;
int main() {
  read(l);
  s.push(1);
  for (int i = 1; i <= l; ++i) {
    scanf("%s", buf);
    if (buf[0] == 'a')
      ans += s.top();
    else if (buf[0] == 'e')
      s.pop();
    else {
      read(x);
      s.push(std::min(INF, x * s.top()));
    }
  }
  if (ans >= INF)
    puts("OVERFLOW!!!");
  else
    printf("%lld\n", ans);
}
