#include <bits/stdc++.h>
using namespace std;
int n;
char a[100005];
int a2[100005];
bool flag[100005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> a2[i];
  }
  int t = 1;
  while (1) {
    if (a[t] == '<') {
      t = t - a2[t];
    } else if (a[t] == '>') {
      t = t + a2[t];
    }
    if (t > n || t < 1) {
      cout << "FINITE";
      break;
    }
    if (flag[t] == 1) {
      cout << "INFINITE";
      break;
    }
    flag[t] = 1;
  }
  return 0;
}
