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