#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
const ll INF = 1LL << 32;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res = 0;
  int add_cnt = 0;
  vll v;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (s == "add") {
      if (v.empty())
        res++;
      else {
        if (v.back() == 0) {
          cout << "OVERFLOW!!!\n";
          return 0;
        }
        res += v.back();
      }
    } else if (s == "end") {
      v.pop_back();
    } else {
      ll x;
      cin >> x;
      if (v.empty())
        v.push_back(x);
      else {
        v.push_back(v.back() * x);
        if (v.back() >= INF) v.back() = 0;
      }
    }
  }
  if (res >= INF) {
    cout << "OVERFLOW!!!\n";
    return 0;
  }
  cout << res << '\n';
}
