#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  string str;
  stack<long long int> s;
  s.push(1);
  long long int ans = 0;
  long long int value = (long long int)(pow(2, 32));
  while (n--) {
    cin >> str;
    if (str == "for") {
      int x;
      cin >> x;
      s.push(min(value, s.top() * x));
    } else if (str == "add") {
      ans += s.top();
      ans = min(ans, value);
    } else
      s.pop();
  }
  if (ans == value)
    cout << "OVERFLOW!!!" << '\n';
  else
    cout << ans << '\n';
  return 0;
}
