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