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