#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  stack<long long int> s;
  long long int num(0);
  long long int n;
  cin >> n;
  long long int lasttime(1);
  long long int maxi = (1LL << 32);
  while (n--) {
    string in;
    cin >> in;
    if (in == "add" && s.empty())
      num++;
    else if (in == "add" && !s.empty()) {
      num = num + s.top();
    } else if (in == "for") {
      long long int times;
      cin >> times;
      times = min(maxi, times * lasttime);
      s.push(times);
      lasttime = times;
    } else {
      s.pop();
      lasttime = s.empty() ? 1 : s.top();
    }
  }
  num >= maxi ? cout << "OVERFLOW!!!" : cout << num;
  return 0;
}
