#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  string s;
  cin >> s;
  vector<int> a(n);
  vector<bool> used(n, false);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int cur = 0;
  while (true) {
    used[cur] = true;
    int next = a[cur];
    if (s[cur] == '<') next *= -1;
    int nw = cur + next;
    if (nw < 0 || nw >= n) {
      cout << "FINITE";
      return 0;
    }
    if (used[nw]) {
      cout << "INFINITE";
      return 0;
    }
    cur = nw;
  }
  return 0;
}
