#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ar[100010], flag = 1, cnt = 1;
  char s[100010];
  scanf("%d", &n);
  getchar();
  for (int i = 1; i <= n; i++) scanf("%c", &s[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &ar[i]);
  for (int i = 1; i <= n; i++) {
    if (s[cnt] == '>')
      cnt += ar[cnt];
    else
      cnt -= ar[cnt];
    if (cnt > n || cnt < 1) {
      printf("FINITE\n");
      flag = 0;
      break;
    }
  }
  if (flag) printf("INFINITE\n");
  return 0;
}
