#include <bits/stdc++.h>
long m = 100100;
using namespace std;
int main() {
  long long n, i, nawras = 49, qasso[100100];
  nawras -= 49;
  string goro;
  cin >> n >> goro;
  for (i = 0; i < n; i++) cin >> qasso[i];
  i = 0;
  while (m--) {
    goro[i] == '>' ? nawras += qasso[i] : nawras -= qasso[i];
    if (nawras < 0 || nawras >= n) {
      cout << "FINITE";
      return 0;
    }
    goro[i] == '>' ? i += qasso[i] : i -= qasso[i];
  }
  cout << "INFINITE";
  return 0;
}
