#include <bits/stdc++.h>
using namespace std;
void in() {}
int main() {
  in();
  int n, t;
  cin >> n;
  string str;
  cin >> str;
  map<int, int> mp, mp2;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &t);
    if (str[i] == '>') {
      mp[i + 1] = i + 1 + t;
    } else {
      mp[i + 1] = i + 1 - t;
    }
  }
  int f = 0;
  t = 1;
  mp2[t]++;
  while (1) {
    t = mp[t];
    if (mp2[t] > 0) {
      f = 1;
      break;
    }
    if (t > n || t <= 0) break;
    mp2[t]++;
  }
  puts(f ? "INFINITE" : "FINITE");
  return 0;
}
