#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int main() {
  long long int ans = 0;
  long long int m = (1LL << 32);
  int l;
  cin >> l;
  vector<long long int> v = {1};
  for (int i = 0; i < l; i++) {
    string t;
    cin >> t;
    if (t == "add")
      ans += v.back();
    else if (t == "for") {
      int num;
      cin >> num;
      v.push_back(min(m, v.back() * num));
    } else
      v.pop_back();
  }
  if (ans >= m)
    cout << "OVERFLOW!!!";
  else
    cout << ans;
}
