#include <bits/stdc++.h>
using namespace std;
unsigned long long use[105];
unsigned long long fastExpo(unsigned long long num, unsigned long long expo) {
  if (expo == 0) return 1;
  if (expo == 1) return num;
  unsigned long long tmp = fastExpo(num, expo / 2);
  if (tmp > 4294967295) return 0;
  tmp *= tmp;
  if (tmp > 4294967295) return 0;
  if (expo % 2 == 1) tmp *= num;
  if (tmp > 4294967295) return 0;
  return tmp;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int t;
  stack<pair<string, unsigned long long>> prev;
  unsigned long long add = 0;
  unsigned long long x = 0;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    string cmd;
    cin >> cmd;
    if (cmd == "add") {
      unsigned long long tmp = 1;
      for (int j = 1; j <= 100; j++) {
        tmp *= fastExpo(j, use[j]);
        if (tmp == 0 || tmp > 4294967295) {
          cout << "OVERFLOW!!!\n";
          return 0;
        }
      }
      x += tmp;
      if (x > 4294967295) {
        cout << "OVERFLOW!!!\n";
        return 0;
      }
    } else if (cmd == "for") {
      unsigned long long tmp;
      cin >> tmp;
      prev.push({cmd, tmp});
      use[tmp]++;
    } else {
      while (prev.top().first != "for") {
        prev.pop();
      }
      use[prev.top().second]--;
      prev.pop();
    }
  }
  cout << x << '\n';
}
