#include <bits/stdc++.h>
using namespace std;
int vis[100001];
char A[100001];
int D[100001];
void solve() {
  int n;
  scanf("%d", &n);
  scanf("%s", A);
  for (int i = 0; i < n; i++) scanf("%d", &D[i]);
  int i = 0, f = 0;
  while (true) {
    if (vis[i]) {
      f = 1;
      break;
    }
    vis[i] = 1;
    i = i + (A[i] == '>' ? D[i] : -D[i]);
    if (i < 0 || i >= n) break;
  }
  if (f)
    puts("INFINITE");
  else
    puts("FINITE");
}
int main() { solve(); }
