#include <bits/stdc++.h>
using namespace std;
long long a[1000007], b[1000007];
int main() {
  int n;
  cin >> n;
  long long x = 0LL, idx = 0LL, loop = 1LL;
  int flag = 0;
  string t;
  for (int i = 0; i < 1000007; i++) a[i] = 1e18 + 7;
  a[0] = 1;
  while (n--) {
    cin >> t;
    loop = min(a[idx], loop);
    if (t == "for") {
      idx++;
      cin >> a[idx];
      a[idx] = a[idx - 1] * a[idx];
      if (a[idx] > 4294967295) flag = 1;
      b[idx] = flag;
    }
    if (t == "end") {
      b[idx] = 0;
      idx--;
    }
    if (t == "add") {
      if (b[idx] == 1) {
        cout << "OVERFLOW!!!\n";
        return 0;
      }
      x += a[idx];
    }
    if (x > 4294967295) {
      cout << "OVERFLOW!!!\n";
      return 0;
    }
    if (a[idx] > 4294967295) flag = 1;
    if (b[idx] == 0) flag = 0;
  }
  if (x > 4294967295) {
    cout << "OVERFLOW!!!\n";
    return 0;
  }
  cout << x << endl;
  return 0;
}
