#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 5;
char s[maxn];
int vis[maxn], a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(vis, 0, sizeof(vis));
  int x = 1;
  while (1) {
    if (vis[x]) {
      printf("INFINITE\n");
      break;
    }
    vis[x] = 1;
    int nx = 0;
    if (s[x] == '>')
      x = x + a[x];
    else
      x = x - a[x];
    if (x < 1 || x > n) {
      printf("FINITE\n");
      break;
    }
  }
}
