#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, max = -1;
  string wrd;
  cin >> n;
  cin >> wrd;
  vector<long long int> vec(n), vec_1(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  vec_1[0] += 1;
  while (1) {
    static int i = 0;
    if (wrd[i] == '>') {
      if (vec[i] + i >= n) {
        cout << "FINITE" << endl;
        return 0;
      } else {
        if (vec_1[vec[i] + i] == 1) {
          cout << "INFINITE" << endl;
          return 0;
        } else {
          i = i + vec[i];
          vec_1[i] += 1;
        }
      }
    } else {
      if (i - vec[i] < 0) {
        cout << "FINITE" << endl;
        return 0;
      } else {
        if (vec_1[i - vec[i]] == 1) {
          cout << "INFINITE" << endl;
          return 0;
        } else {
          i = i - vec[i];
          vec_1[i] += 1;
        }
      }
    }
  }
  return 0;
}
