#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  int A[n];
  bool B[n];
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    B[i] = false;
  }
  int cur = 0;
  while (true) {
    if (cur < 0 || cur >= n) {
      cout << "FINITE" << endl;
      return 0;
    }
    if (B[cur]) {
      cout << "INFINITE" << endl;
      return 0;
    }
    B[cur] = true;
    if (str[cur] == '<')
      cur -= A[cur];
    else
      cur += A[cur];
  }
  return 0;
}
