#include <bits/stdc++.h>
char c[101273];
int n, g[101000];
bool visit[100010];
int main() {
  scanf("%d", &n);
  scanf("%s", c + 1);
  for (int i = 1; i <= n; i++) scanf("%d", &g[i]);
  int now = 1 + 1 - 1;
  while (1) {
    if (visit[now]) {
      printf("INFINITE\n");
      return 0;
    }
    visit[now] = 1;
    if (c[now] == '>')
      now += g[now];
    else
      now -= g[now];
    if (now > n || now < 1) {
      printf("FINITE");
      return 0;
    }
  }
}
