#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, flag = 0, k = 0;
  cin >> n;
  string s;
  cin >> s;
  int d[n];
  for (i = 0; i < n; i++) {
    cin >> d[i];
  }
  vector<int> v(n, 0);
  i = 0;
  v[0] = 1;
  while (k == 0) {
    if (s[i] == '>') {
      i += d[i];
    } else {
      i -= d[i];
    }
    if (i < 0 || i >= n) {
      cout << "FINITE" << '\n';
      ;
      return 0;
    }
    v[i]++;
    if (v[i] == 2) {
      cout << "INFINITE" << '\n';
      ;
      return 0;
    }
  }
  return 0;
}
