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