#include <bits/stdc++.h>
using namespace std;
bool used[int(1e5 + 5)];
long long d[int(1e5 + 5)];
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '<') d[i] = -1;
  }
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    if (d[i] == -1)
      d[i] = -t;
    else
      d[i] = t;
  }
  int th = 0;
  while (true) {
    if (used[th]) {
      cout << "INFINITE" << endl;
      return 0;
    }
    used[th] = true;
    th += d[th];
    if (th < 0 || th >= n) {
      cout << "FINITE" << endl;
      return 0;
    }
  }
}
