#include <bits/stdc++.h>
using namespace std;
long long n, a[200000], d[200000];
int main() {
  string s;
  cin >> n >> s;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long i = 0;
  do {
    if (d[i] == 1) {
      cout << "INFINITE";
      return 0;
    }
    d[i] = 1;
    if (s[i] == '<')
      i -= a[i];
    else
      i += a[i];
  } while (i >= 0 && i < n);
  cout << "FINITE";
}
