#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int i;
  char dir[100000];
  getchar();
  for (i = 0; i < n; i++) {
    dir[i] = getchar();
  }
  int jump[100000];
  for (i = 0; i < n; i++) {
    scanf("%d", &jump[i]);
  }
  char see[100000];
  for (i = 0; i < n; i++) {
    see[i] = 0;
  }
  int at = 0;
  int result = 0;
  while (1) {
    int next;
    if (see[at]) {
      result = 0;
      break;
    }
    if (dir[at] == '>') {
      next = at + jump[at];
    } else {
      next = at - jump[at];
    }
    if (next < 0 || next >= n) {
      result = 1;
      break;
    }
    see[at] = 1;
    at = next;
  }
  if (result == 0) {
    printf("INFINITE\n");
  } else {
    printf("FINITE\n");
  }
  return 0;
}
