#include <bits/stdc++.h>
using namespace std;
int main() {
  const long long maxi = (1ll << 32) - 1;
  long long x = 0;
  cin;
  string s;
  long long d = 1;
  cin >> s;
  vector<long long> fors = {1};
  vector<long long> mul = {1};
  vector<bool> is_overflowed = {false};
  while (cin >> s) {
    if (s[0] == 'f') {
      cin >> d;
      fors.push_back(d);
      mul.push_back(mul.back() * d);
      if (!is_overflowed.back()) {
        is_overflowed.push_back(mul.back() > maxi);
      } else {
        is_overflowed.push_back(true);
      }
    } else if (s[0] == 'e') {
      fors.pop_back();
      mul.pop_back();
      is_overflowed.pop_back();
    } else {
      if (is_overflowed.back()) {
        cout << "OVERFLOW!!!";
        return 0;
      }
      x += mul.back();
      if (x > maxi) {
        cout << "OVERFLOW!!!";
        return 0;
      }
    }
  }
  cout << x;
}
