#include <bits/stdc++.h>
const int maxn = 100000 + 100;
char s[maxn];
int vis[maxn], d[maxn];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  memset(d, 0, sizeof(d));
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &d[i]);
  }
  vis[1] = true;
  int now = 1, flag;
  while (1) {
    if (s[now - 1] == '>') {
      if (now + d[now] > n) {
        flag = false;
        break;
      } else {
        now += d[now];
        if (vis[now]) {
          flag = true;
          break;
        }
        vis[now] = true;
      }
    } else if (s[now - 1] == '<') {
      if (now - d[now] < 1) {
        flag = false;
        break;
      } else {
        now -= d[now];
        if (vis[now]) {
          flag = true;
          break;
        }
        vis[now] = true;
      }
    }
  }
  printf("%s\n", flag ? "INFINITE" : "FINITE");
  return 0;
}
