#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
int n;
int m;
char h[100100];
int d[100100];
int was[100100];
int main() {
  scanf("%d", &n);
  scanf(" %s", h);
  for (int i = 0; i < n; i++) scanf("%d", &d[i]);
  int cur = 0;
  while (cur >= 0 && cur < n) {
    if (was[cur]) {
      printf("INFINITE\n");
      return 0;
    }
    was[cur] = 1;
    if (h[cur] == '<')
      cur -= d[cur];
    else
      cur += d[cur];
  }
  printf("FINITE\n");
  return 0;
}
