#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
int a[100005];
int u[100005];
int main() {
  int n;
  scanf("%d", &n);
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int x = 0;
  while (1) {
    u[x] = 1;
    int sg = 1;
    if (s[x] == '<') sg = -1;
    x += sg * a[x];
    if (x >= n || x < 0) {
      cout << "FINITE";
      return 0;
    }
    if (u[x]) {
      cout << "INFINITE";
      return 0;
    }
  }
  return 0;
}
