#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> v;
  long long a, b, c, d = 0, e = 0, f = 0, g = 0, i, j, k, l = 1, r[300001],
                     n[300001], m[300001], z[400001], h[600001], p[600001];
  string s, t, x, y;
  double q, u, w;
  cin >> a >> s;
  b = a;
  for (i = 0; i < a; i++) {
    cin >> p[i];
  }
  k = 0;
  while (a > 0) {
    if (s[k] == '>') {
      k += p[k];
      if (k >= b) {
        cout << "FINITE";
        exit(0);
      }
    } else {
      k -= p[k];
      if (k < 0) {
        cout << "FINITE";
        exit(0);
      }
    }
    a--;
  }
  cout << "INFINITE";
}
