#include <bits/stdc++.h>
char dir[100010];
int gage[100010];
bool chk[100010];
int main() {
  int i, n;
  int d;
  scanf("%d", &n);
  scanf("%s", dir);
  for (i = 0; i < n; i++) scanf("%d", &gage[i]);
  d = 0;
  while (!chk[d]) {
    chk[d] = true;
    if (dir[d] == '<')
      d -= gage[d];
    else if (dir[d] == '>')
      d += gage[d];
    if (d < 0 || d >= n) {
      printf("FINITE");
      return 0;
    }
  }
  printf("INFINITE");
  return 0;
}
