#include <bits/stdc++.h>
using namespace std;
int n, idx = 1, d[100003], x[100003];
bool vis[100003];
string m;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) x[i + 1] = (m[i] == '<' ? -1 : 1);
  for (int i = 1; i <= n; i++) cin >> d[i];
  while (1) {
    if (idx < 1 || idx > n) {
      cout << "FINITE";
      break;
    }
    if (vis[idx]) {
      cout << "INFINITE";
      break;
    }
    vis[idx] = true;
    idx += x[idx] * d[idx];
  }
  return 0;
}
