#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int a[100001], b[100001] = {0};
  int n;
  cin >> n;
  cin >> s;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int i = 1;
  while (b[i] == 0) {
    b[i] = 1;
    if (s[i - 1] == '<')
      i -= a[i];
    else
      i += a[i];
    if (i < 1 || i > n) {
      cout << "FINITE";
      return 0;
    }
  }
  cout << "INFINITE";
  return 0;
}
