#include <bits/stdc++.h>
using namespace std;
struct p {
  char sig;
  int num;
  bool vis = 0;
} a[100005];
int main() {
  int n, point = 1;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].sig;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i].num;
  }
  while (!a[point].vis) {
    a[point].vis = 1;
    if (a[point].sig == '>' && point + a[point].num <= n) {
      point = point + a[point].num;
    } else if (a[point].sig == '<' && point - a[point].num >= 1) {
      point = point - a[point].num;
    } else {
      cout << "FINITE";
      return 0;
    }
  }
  cout << "INFINITE";
  return 0;
}
