#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout.setf(ios_base::fixed);
  cout.precision(28);
  string s;
  int n;
  cin >> n;
  cin >> s;
  vector<int> x(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  set<int> ex;
  int st = 0;
  for (;;) {
    ex.insert(st);
    int zn = 1;
    if (s[st] == '<') {
      zn = -1;
    }
    st = st + zn * x[st];
    if (ex.find(st) != ex.end()) {
      cout << "INFINITE" << endl;
      exit(0);
    }
    if (st < 0 || st >= n) {
      break;
    }
  }
  cout << "FINITE" << endl;
  return 0;
}
