#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int d[n];
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  int b = 0;
  for (int i = 0; i <= n; i++) {
    if (b < 0 || b >= n) {
      cout << "FINITE";
      return 0;
    } else if (s[b] == '>') {
      b += d[b];
    } else
      b -= d[b];
  }
  cout << "INFINITE";
  return 0;
}
