#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  getchar();
  char dir[100001];
  for (int i = 1; i <= n; i++) scanf("%c", &dir[i]);
  int dis[100001];
  for (int i = 1; i <= n; i++) scanf("%d", &dis[i]);
  int loc = 1;
  bool loop = false;
  bool chk[100001];
  memset(chk, 0, sizeof(chk));
  while (loc >= 1 && loc <= n) {
    if (!chk[loc])
      chk[loc] = true;
    else {
      loop = true;
      break;
    }
    if (dir[loc] == '>') {
      loc += dis[loc];
    } else {
      loc -= dis[loc];
    }
  }
  if (loop)
    printf("INFINITE\n");
  else
    printf("FINITE\n");
  return 0;
}
