#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> x(n);
  vector<bool> f(n, true);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  int l = 0;
  while (1) {
    if (!f[l]) break;
    if (s[l] == '>') {
      if (l + 1 + x[l] > n) {
        cout << "FINITE";
        return 0;
      }
      f[l] = false;
      l += x[l];
    } else {
      if (l + 1 - x[l] <= 0) {
        cout << "FINITE";
        return 0;
      }
      f[l] = false;
      l -= x[l];
    }
  }
  cout << "INFINITE";
  return 0;
}
