#include <bits/stdc++.h>
using namespace std;
char mp[100000];
long len[100000], n, p = 0;
bool w[100000];
int main() {
  cin >> n;
  for (long i = 0; i < n; i++) cin >> mp[i];
  for (long i = 0; i < n; i++) {
    cin >> len[i];
    if (mp[i] == '<') len[i] = -len[i];
  }
  while (true) {
    w[p] = true;
    if (len[p] + p >= n || len[p] + p < 0) {
      cout << "FINITE";
      return 0;
    } else {
      p = len[p] + p;
      if (w[p]) {
        cout << "INFINITE";
        return 0;
      }
    }
  }
  return 0;
}
