#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a;
  string s;
  cin >> t;
  vector<bool> visited(t + 1, false);
  vector<int> vect;
  cin >> s;
  while (t--) {
    cin >> a;
    vect.push_back(a);
  }
  int indx = 1;
  int i = 0;
  while (1) {
    if (s[i] == '>') {
      indx += vect[i];
    } else {
      indx -= vect[i];
    }
    if (indx < 1 || indx > vect.size()) {
      cout << "FINITE" << endl;
      break;
    } else if (visited[indx]) {
      cout << "INFINITE" << endl;
      break;
    }
    visited[indx] = true;
    i = indx - 1;
  }
}
