#include <bits/stdc++.h>
using namespace std;
int n, m, k, l, g[100010];
char c;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf(" %c", &c);
    if (c == '<')
      g[i] = -1;
    else
      g[i] = 1;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &m);
    g[i] *= m;
  }
  k = 0;
  l = g[0];
  while (l >= 0 && l < n && k != l) {
    k += g[k];
    l += g[l];
    if (l < 0 || l >= n) break;
    l += g[l];
  }
  if (k == l)
    printf("INFINITE\n");
  else
    printf("FINITE\n");
  return 0;
}
