#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int inf = 2e9;
const long double eps = 1e-7;
const long double pi = acos(-1);
const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
const int N = 1e5 + 11;
const int M = 1e3 + 11;
const int mod = 1e9 + 7;
string s[N];
long long a[N], p[N];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    if (s[i] == "for") {
      cin >> a[i];
    }
  }
  stack<int> st;
  long long ans = 0;
  long long sum = 1;
  int w = 0;
  long long d = pow(2LL, 32) - 1;
  for (int i = 1; i <= n; i++) {
    if (s[i] == "add") {
      if (w == 1) {
        cout << "OVERFLOW!!!";
        return 0;
      }
      ans += sum;
      if (ans > d) {
        cout << "OVERFLOW!!!";
        return 0;
      }
    } else if (s[i] == "for") {
      st.push(i);
      if (w == 0) {
        sum *= a[i];
        if (sum > d) {
          p[i] = 1;
          w = 1;
        }
      }
    } else {
      if (w == 1) {
        if (p[st.top()] == 1) sum /= a[st.top()], w = 0;
      } else
        sum /= a[st.top()];
      st.pop();
    }
  }
  cout << ans;
}
