#include <bits/stdc++.h>
using namespace std;
const long long over = ((long long)1 << 32) - 1;
int n, h;
long long x;
long long cnt = 0;
vector<long long> f;
int main(void) {
  f.push_back(1);
  cin >> n;
  char t[4];
  bool flag = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> t;
    if (t[0] == 'f') {
      ++cnt;
      f.resize(cnt + 1);
      cin >> h;
      if (over / h < f[cnt - 1]) {
        flag = 1;
      }
      f[cnt] = f[cnt - 1] * h;
    } else if (t[0] == 'a') {
      if (flag) {
        printf("OVERFLOW!!!\n");
        exit(0);
      } else {
        int tmp = x;
        x += f[cnt];
        if (x > over || x < tmp) {
          cout << "OVERFLOW!!!" << endl;
          exit(0);
        }
      }
    } else {
      flag = 0;
      --cnt;
    }
  }
  cout << x << endl;
  return 0;
}
