#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<char> V;
  vector<int> V1;
  int n, n1;
  cin >> n;
  char x1;
  for (int i = 0; i < n; i++) {
    cin >> x1;
    V.push_back(x1);
  }
  for (int i = 0; i < n; i++) {
    cin >> n1;
    V1.push_back(n1);
  }
  int i = 0;
  int sw = 0;
  while (V[i] != 'a') {
    if (V[i] == '>') {
      int a = V1[i] + i;
      if (a < n and a >= 0) {
        V1[i] = -1;
        V[i] = 'a';
        i = a;
      } else {
        sw = 1;
        break;
      }
    }
    if (V[i] == '<') {
      int a = i - V1[i];
      if (a < n and a >= 0) {
        V1[i] = -1;
        V[i] = 'a';
        i = a;
      } else {
        sw = 1;
        break;
      }
    }
  }
  if (sw == 0) {
    cout << "INFINITE";
  } else {
    cout << "FINITE";
  }
}
