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