#include <bits/stdc++.h>
using namespace std;
char s[100002];
bool fr[100002] = {false};
int a[100002];
int main() {
  int n;
  scanf("%d%*c", &n);
  gets(s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    if (s[i - 1] == '<') a[i] = -a[i];
  }
  fr[1] = true;
  int c = 1;
  while (c >= 1 && c <= n) {
    c = c + a[c];
    if (c < 1 || c > n) break;
    if (fr[c] == false)
      fr[c] = true;
    else {
      cout << "INFINITE";
      return 0;
    }
  }
  cout << "FINITE";
  return 0;
}
