#include <bits/stdc++.h>
using namespace std;
int v[100010];
int j[100010];
string ss;
bool haha;
int m;
void jump(int n) {
  if (n < 0 || n >= m) {
    haha = true;
    return;
  } else if (j[n] == 1) {
    haha = false;
    return;
  } else {
    int p;
    if (ss[n] == '<')
      p = -1;
    else if (ss[n] == '>')
      p = 1;
    j[n] = 1;
    jump(n + p * v[n]);
    return;
  }
}
int main(int argc, const char* argv[]) {
  memset(j, 0, sizeof(j));
  memset(v, 0, sizeof(v));
  int n;
  cin >> n;
  m = n;
  cin >> ss;
  haha = true;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  jump(0);
  if (haha) {
    printf("FINITE\n");
  } else {
    printf("INFINITE\n");
  }
  return 0;
}
