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