#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  int a[k], r[k];
  memset(r, 0, sizeof(r));
  char c[k];
  for (int i = 0; i < k; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < k; i++) {
    cin >> a[i];
  }
  int i = 0;
  while (i >= 0 && i < k) {
    if (r[i]) {
      cout << "INFINITE" << endl;
      return 0;
    }
    r[i] = true;
    if (c[i] == '>') {
      i += a[i];
    } else {
      i -= a[i];
    }
  }
  cout << "FINITE" << endl;
}
