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