#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long int n, x = 1, ans = 0, w = 0, q;
    string s;
    cin >> n;
    long long int p = pow(2, 32) - 1;
    stack<long long int> stackstack;
    for (int i = 0; i < n; i++) {
      cin >> s;
      if (s == "for") cin >> q;
      if (s == "add" && stackstack.empty() == 1) {
        if (ans + 1 > p) {
          cout << "OVERFLOW!!!";
          return 0;
        } else
          ans += 1;
      } else if (s == "add") {
        if (stackstack.top() == p + 1) {
          cout << "OVERFLOW!!!";
          return 0;
        }
        if (stackstack.top() + ans > p) {
          cout << "OVERFLOW!!!";
          return 0;
        }
        ans += stackstack.top();
      } else if (s == "end") {
        stackstack.pop();
      } else if (s == "for") {
        if (stackstack.empty())
          x = 1;
        else
          x = stackstack.top();
        if (x * q > p)
          stackstack.push(p + 1);
        else
          stackstack.push(x * q);
      }
    }
    cout << ans;
  }
  return 0;
}
