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