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