#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, c, flg;
  map<long long, pair<long long, int> > trace;
  string x;
  cin >> n;
  cin >> x;
  for (long long i = 1; i <= n; i++) {
    cin >> c;
    trace[i] = make_pair(c, 0);
  }
  flg = 1;
  while (true) {
    trace[flg].second++;
    if (trace[flg].second > 2) {
      cout << "INFINITE" << endl;
      return 0;
    }
    if (trace[flg].first > n) {
      cout << "FINITE" << endl;
      return 0;
    }
    if (x[flg - 1] == '>' && (trace[flg].first + flg) > n) {
      cout << "FINITE" << endl;
      return 0;
    }
    if (x[flg - 1] == '<' && (flg - trace[flg].first) <= 0) {
      cout << "FINITE" << endl;
      return 0;
    }
    if (x[flg - 1] == '>')
      flg += trace[flg].first;
    else
      flg -= trace[flg].first;
  }
  cout << "INFINITE" << endl;
  return 0;
}
