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