#include <bits/stdc++.h>
using namespace std;
char s[100010];
bool visited[100010];
int step[100010];
int main() {
  int n, i;
  scanf("%d", &n);
  scanf("%s", s);
  for (i = 0; i < n; i++) {
    scanf("%d", &step[i]);
  }
  int pos = 0;
  bool out = false;
  visited[pos] = true;
  while (true) {
    if (s[pos] == '>')
      pos += step[pos];
    else
      pos -= step[pos];
    if (!(0 <= pos && pos < n)) {
      out = true;
      break;
    }
    if (visited[pos])
      break;
    else
      visited[pos] = true;
  }
  printf(out ? "FINITE\n" : "INFINITE\n");
}
