#include <bits/stdc++.h>
using namespace std;
long long a, n, w, h, m, k, b;
string s, sl, sr;
void solve() {
  long long ans = 0;
  vector<long long> vec;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == "for") {
      cin >> a;
      if (vec.size() == 0)
        vec.push_back(a);
      else
        vec.push_back(a * vec.back());
      if (vec.back() > UINT_MAX || vec.back() < 0) vec[vec.size() - 1] = -1;
    }
    if (s == "end") {
      vec.pop_back();
    }
    if (s == "add") {
      if (vec.size() == 0) {
        ans++;
      } else {
        if (vec.back() == -1) {
          cout << "OVERFLOW!!!";
          return;
        }
        ans += vec.back();
      }
      if (ans > UINT_MAX) {
        cout << "OVERFLOW!!!";
        return;
      }
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cout << setprecision(10);
  int t = 1;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
