#include <bits/stdc++.h>
using namespace std;
int main() {
  char tmp;
  int l;
  long long n = 0;
  cin >> n;
  long long *arr = new long long[n];
  bool *was = new bool[n];
  for (long long i = 0; i < n; i++) {
    cin >> tmp;
    arr[i] = (tmp == '>' ? 1 : -1);
  }
  for (long long i = 0; i < n; i++) {
    cin >> l;
    arr[i] *= l;
    was[i] = false;
  }
  int j = 0;
  while (j >= 0 && j < n) {
    if (was[j]) {
      cout << "INFINITE" << endl;
      return 0;
    }
    was[j] = true;
    j += arr[j];
  }
  cout << "FINITE" << endl;
}
