#include <bits/stdc++.h>
const int MAXN = 100010;
int n;
char st[MAXN];
int a[MAXN];
bool b[MAXN];
bool dfs(int k) {
  if (b[k] == true) {
    return true;
  } else {
    b[k] = true;
  }
  int tmp = k + a[k];
  if ((tmp > n) || (tmp < 1)) {
    return false;
  } else {
    return dfs(tmp);
  }
}
int main() {
  scanf("%d", &n);
  scanf("%s", &st);
  for (int i = 1; i <= n; i++) {
    if (st[i - 1] == '>') {
      a[i] = 1;
    } else {
      a[i] = -1;
    }
  }
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[i] *= x;
  }
  memset(b, false, sizeof(b));
  if (dfs(1)) {
    printf("INFINITE\n");
  } else {
    printf("FINITE\n");
  }
  return 0;
}
