#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, w[100010], a[100010], num, b[100010];
  char ch;
  while (scanf("%d", &n) != EOF) {
    memset(w, 0, sizeof(w));
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    getchar();
    for (i = 1; i <= n; i++) {
      scanf("%c", &ch);
      if (ch == '<')
        a[i] = -1;
      else
        a[i] = 1;
    }
    for (i = 1; i <= n; i++) {
      scanf("%d", &num);
      b[i] = i + a[i] * num;
    }
    i = 1;
    int flag = 0;
    while (w[i] <= 1) {
      if (b[i] < 1 || b[i] > n) {
        flag = 1;
        break;
      }
      i = b[i];
      w[i]++;
    }
    if (flag == 1)
      printf("FINITE\n");
    else
      printf("INFINITE\n");
  }
  return 0;
}
