#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 7;
char op[MAX];
int jump[MAX];
int main() {
  int n, loc = 0;
  cin >> n >> op;
  for (int i = 0; i < n; i++) {
    cin >> jump[i];
  }
  while (loc >= 0 && loc < n) {
    if (op[loc] == '*') break;
    if (op[loc] == '>') {
      op[loc] = '*';
      loc += jump[loc];
    } else {
      op[loc] = '*';
      loc -= jump[loc];
    }
  }
  if (loc >= 0 && loc < n)
    cout << "INFINITE\n";
  else
    cout << "FINITE\n";
  return 0;
}
