#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, pos = 0;
  cin >> n;
  char ch[n];
  cin >> ch;
  long long int aa[n];
  for (i = 0; i < n; i++) scanf("%I64d", &aa[i]);
  map<int, int> mp;
  mp[0] = 1;
  while (1) {
    if (ch[pos] == '>')
      pos += aa[pos];
    else
      pos -= aa[pos];
    mp[pos]++;
    if (pos < 0 || pos >= n) {
      cout << "FINITE";
      return 0;
    }
    if (mp[pos] == 2) {
      cout << "INFINITE";
      return 0;
    }
  }
  return 0;
}
