#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 32;
long long ans = 0;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int l;
  cin >> l;
  stack<long long> cur;
  cur.push(1);
  while (l--) {
    string s;
    cin >> s;
    if (s == "for") {
      int n;
      cin >> n;
      cur.push(min(INF, cur.top() * n));
    } else if (s == "end")
      cur.pop();
    else
      ans += cur.top();
  }
  if (ans >= INF)
    cout << "OVERFLOW!!!"
         << "\n";
  else
    cout << ans << "\n";
  return 0;
}
