#include <bits/stdc++.h>
int main() {
  int a, d, e, f, g, h, i, j, c = 0;
  char ch[100005];
  long long r = 0, b[100005];
  scanf("%d", &a);
  scanf("%s", ch);
  for (i = 0; i < a; i++) {
    scanf("%I64d", &b[i]);
  }
  for (j = 0;; j += r) {
    if (ch[j] == '>') {
      r = r + b[j];
      if (r < 0 || r > a - 1) {
        printf("FINITE");
        break;
      }
      c++;
      j = 0;
    } else if (ch[j] == '<') {
      r = r - b[j];
      if (r < 0 || r > a - 1) {
        printf("FINITE");
        break;
      }
      c++;
      j = 0;
    }
    if (c == a) break;
  }
  if (c == a) printf("INFINITE");
  return 0;
}
