#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int d[maxn], n;
char s[maxn];
bool v[maxn];
int main() {
  scanf("%d", &n);
  scanf("%s", s);
  for (int i = 0; i < n; i++) {
    scanf("%d", &d[i]);
    if (s[i] == '<') d[i] *= -1;
  }
  int now;
  while (1) {
    if (v[now]) {
      cout << "INFINITE" << endl;
      return 0;
    }
    v[now] = 1;
    now = now + d[now];
    if (now < 0 || now >= n) break;
  }
  cout << "FINITE" << endl;
  return 0;
}
