#include <bits/stdc++.h>
using namespace std;
template <typename T>
T sqr(T a) {
  return a * a;
}
template <typename T>
bool uax(T &a, const T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool uin(T &a, const T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &p) {
  out << p.first << ' ' << p.second;
  return out;
}
mt19937_64 gen_rand;
const int N = (int)4e5 + 7;
const int N_ = (int)1007;
const int MAXN = (int)5e6 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const int ITER = (int)20;
const int LOG = 30;
const int SIZE = 1100;
const int ALPH = 256;
const int DIGIT = 10;
const int BLOCK = 350;
const int LIGHT = 350;
const long long LINF = (int64_t)2e18;
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-8;
int n, cnt[200];
long long x = 0;
void read() { cin >> n; }
long long get() {
  long long res = 1;
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < cnt[i]; j++) {
      res *= i;
      if (res >= (1LL << 32)) return -1;
    }
  }
  return res;
}
void upd(int x, int sign) {
  for (int i = 2; i * i <= x; i++) {
    while (x % i == 0) cnt[i] += sign, x /= i;
  }
  if (x != 1) cnt[x] += sign;
}
void solve() {
  int cnt[200] = {};
  vector<int> fr;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (s[0] == 'f') {
      int val;
      cin >> val;
      upd(val, 1);
      fr.push_back(val);
    }
    if (s[0] == 'e') {
      upd(fr.back(), -1);
      fr.pop_back();
    }
    if (s[0] == 'a') {
      long long add = get();
      if (add == -1) {
        cout << "OVERFLOW!!!";
        exit(0);
      }
      x += max(add, 1LL);
      if (x >= (1LL << 32)) {
        cout << "OVERFLOW!!!";
        exit(0);
      }
    }
  }
  cout << x;
}
double max_time = 0;
void gen() {}
void stupid() {}
void write() {}
void stress() {}
void check_time() {
  double start = clock();
  read(), solve();
  cout << "\nTime is " << (clock() - start) / 1000.0 << "s\n";
}
void check_rand_time() {
  gen_rand.seed(int(clock()));
  double start = clock();
  gen(), solve();
  double cur_time = (clock() - start) / 1000.0;
  uax(max_time, cur_time);
  cerr << "cur_time = " << cur_time << "    ||    "
       << "max_time = " << max_time << "\n";
}
int main() {
  cout << fixed << setprecision(20);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  gen_rand.seed(time(0));
  read();
  solve();
}
