#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned int amnt[100000];
  int d[100000];
  char dir[100000];
  bool seen[100000], infinite = false;
  memset(seen, false, 100000 * sizeof(bool));
  int n, now = 0, j = 0, sum = 0;
  cin >> n;
  cin >> dir;
  for (int i = 0; i < n; i++) {
    cin >> amnt[i];
    d[i] = dir[i] / 2 - 31 + (dir[i] / 2) % 2;
    sum += d[i] * amnt[i];
  }
  while (true) {
    now += amnt[now] * d[now];
    if (now >= n || now < 0) break;
    if (!seen[now])
      seen[now] = true;
    else {
      infinite = true;
      break;
    }
  }
  if (infinite)
    cout << "INFINITE";
  else
    cout << "FINITE";
}
