#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k = 0;
  cin >> n;
  bool napr[100000];
  int a[100000];
  char zn;
  int pos = 0;
  for (int i = 0; i < n; i++) {
    cin >> zn;
    if (zn == '>')
      napr[i] = true;
    else
      napr[i] = false;
  }
  for (int i = 0; i < n; i++) cin >> a[i];
  int i = 0;
  while (k < 101000) {
    if (napr[i] == true)
      pos += a[i];
    else
      pos -= a[i];
    i = pos;
    k++;
    if (pos < 0 || pos >= n) {
      cout << "FINITE";
      return 0;
    }
  }
  cout << "INFINITE";
  return 0;
}
