#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
int n;
int d[N];
char s[N];
bool u[N];
void go(int x) {
  if (x < 1 || x > n) {
    puts("FINITE");
    exit(0);
  }
  if (u[x]) {
    puts("INFINITE");
    exit(0);
  }
  u[x] = true;
  if (s[x] == '>') {
    go(x + d[x]);
  } else {
    go(x - d[x]);
  }
}
int main() {
  scanf("%d\n", &n);
  gets(s + 1);
  for (int i = 1; i <= n; i++) scanf("%d", &d[i]), u[i] = false;
  go(1);
  return 0;
}
