#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int len;
  cin >> len;
  vector<bool> dirs;
  for (int i = 0; i < len; ++i) {
    char d;
    cin >> d;
    dirs.push_back(d == '<' ? 0 : 1);
  }
  vector<int> dists;
  for (int i = 0; i < len; ++i) {
    int d;
    cin >> d;
    dists.push_back(d);
  }
  vector<bool> hist(dists.size(), 0);
  int cur_ind = 0;
  while (cur_ind >= 0 && cur_ind < len && !hist[cur_ind]) {
    hist[cur_ind] = 1;
    auto d = dists[cur_ind];
    cur_ind = dirs[cur_ind] ? cur_ind + d : cur_ind - d;
  }
  if (cur_ind < 0 || cur_ind >= len)
    cout << "FINITE";
  else
    cout << "INFINITE";
}
