#include <bits/stdc++.h>
char s[1000006];
int a[1000006];
int b[1000006];
int main(void) {
  int n, i, c = 0, f = 0;
  scanf("%d", &n);
  scanf("%s", s);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  while (c >= 0 && c < n) {
    if (b[c] == 1) {
      f = 0;
      break;
    }
    b[c] = 1;
    if (s[c] == '>') {
      c += a[c];
    } else if (s[c] == '<') {
      c -= a[c];
    }
    if (c >= n || c < 0) {
      f = 1;
      break;
    }
  }
  if (f == 1) {
    printf("FINITE\n");
  } else if (f == 0) {
    printf("INFINITE\n");
  }
  return 0;
}
