#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string dir;
  cin >> dir;
  vector<int> jump(n);
  vector<bool> flag(n, false);
  int cur;
  for (int i = 0; i < n; i++) {
    cin >> cur;
    if (dir[i] == '<') {
      cur = -cur;
    }
    jump[i] = cur;
  }
  cur = 0;
  while (flag[cur] == false) {
    flag[cur] = true;
    int next = cur + jump[cur];
    if (next < 0 || next >= n) {
      cout << "FINITE\n";
      return 0;
    }
    cur = next;
  }
  cout << "INFINITE\n";
}
