#include <bits/stdc++.h>
using namespace std;
int n, a[100001], l;
string s;
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    if (l < 0 || l >= n) {
      cout << "FINITE";
      return 0;
    }
    (s[l] == '>' ? l += a[l] : l -= a[l]);
  }
  cout << "INFINITE";
}
