#include <bits/stdc++.h>
int main(void) {
  long long int N, *num, ans, start = 0;
  int *ind;
  char c, *car;
  int flag = 0;
  scanf("%I64d\n", &N);
  car = (char *)malloc(sizeof(char) * N);
  num = (long long int *)malloc(sizeof(long long int) * N);
  ind = (int *)malloc(sizeof(int) * N);
  for (long int i = 0; i < N; i++) {
    scanf("%c", &car[i]);
  }
  scanf("%c", &c);
  ans = 0;
  for (long int i = 0; i < N; i++) {
    scanf("%I64d", &num[i]);
    ind[i] = 0;
  }
  flag = 0;
  while (start >= 0 && start < N) {
    if (ind[start] == 1) {
      flag = 1;
      break;
    } else {
      ind[start] = 1;
    }
    if (car[start] == '>') {
      start = start + num[start];
    } else {
      start = start - num[start];
    }
    if (start < 0 || start >= N) break;
  }
  if (flag == 1) {
    printf("INFINITE");
  } else {
    printf("FINITE");
  }
  return 0;
}
