#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  string s;
  cin >> s;
  int a[n + 1];
  bool check[n + 1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    check[i] = false;
  }
  int x = 1;
  bool flag = false;
  while ((check[x] == false) && (flag == false)) {
    int y;
    check[x] = true;
    if (s[x - 1] == '>')
      y = x + a[x];
    else if (s[x - 1] == '<')
      y = x - a[x];
    if (y <= 0 || y > n) flag = true;
    if (flag) break;
    x = y;
  }
  if (flag)
    printf("FINITE");
  else
    printf("INFINITE");
  return 0;
}
