#include <bits/stdc++.h>
int main() {
  int visited[100005] = {0};
  int n;
  scanf("%d", &n);
  int jum[n];
  char seq[100005];
  scanf("%s", seq);
  for (int i = 0; i < n; i++) {
    scanf("%d", &jum[i]);
  }
  int stuck = 0;
  int finite = 1;
  int i = 0;
  while (1) {
    if (i >= n || i < 0) {
      break;
    }
    if (visited[i]) {
      stuck = 1;
      finite = 0;
      break;
    }
    visited[i] = 1;
    if (seq[i] == '>') {
      i += jum[i];
    } else {
      i -= jum[i];
    }
  }
  printf("%s\n", stuck ? "INFINITE" : "FINITE");
}
