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