#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d", &N);
  static char s[100005];
  scanf("\n%s", s);
  static int a[100005];
  int i;
  for (i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  static char b[100005];
  memset(b, 0, sizeof(b));
  int pos = 0;
  while (!b[pos]) {
    b[pos] = 1;
    if (s[pos] == '<')
      pos -= a[pos];
    else
      pos += a[pos];
    if ((pos < 0) || (pos >= N)) {
      printf("FINITE\n");
      return 0;
    }
  }
  printf("INFINITE\n");
  return 0;
}
