#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string a;
  int pos = 0;
  int flag[n];
  for (int i = 0; i < n; i++) flag[i] = 0;
  cin >> a;
  int b[n];
  for (int i = 0; i < n; i++) cin >> b[i];
  while (true) {
    if (a[pos] == '<') {
      flag[pos] = 1;
      pos = pos - b[pos];
      if (pos < 0) {
        cout << "FINITE";
        break;
      }
    } else if (a[pos] == '>') {
      flag[pos] = 1;
      pos = pos + b[pos];
      if (pos > n - 1) {
        cout << "FINITE";
        break;
      }
    }
    if (flag[pos] == 1) {
      cout << "INFINITE";
      break;
    }
  }
}
