#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n;
char s[maxn];
int b[maxn], vis[maxn];
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  int pos = 1;
  while (true) {
    if (vis[pos]) {
      puts("INFINITE");
      return 0;
    }
    vis[pos] = 1;
    if (s[pos] == '>')
      pos += b[pos];
    else
      pos -= b[pos];
    if (pos < 1 || pos > n) {
      puts("FINITE");
      return 0;
    }
  }
}
