#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, len, current = 0, flag = 1, count = 0;
  vector<int> iLen;
  string dir;
  cin >> n;
  cin >> dir;
  for (int i = 0; i < n; ++i) {
    cin >> len;
    iLen.push_back(len);
  }
  while (current >= 0 && current < n && (count++ < n)) {
    if (dir[current] == '<') {
      current -= iLen[current];
    } else {
      current += iLen[current];
    }
    if (current < 0 || current >= n) {
      cout << "FINITE";
      return 0;
    }
  }
  cout << "INFINITE";
  return 0;
}
