#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  vector<int> len;
  string s;
  vector<int> used;
  int n;
  cin >> n;
  cin >> s;
  len.resize(n);
  used.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> len[i];
  }
  int pos = 0;
  while (1) {
    if (pos < 0 || pos >= n) {
      cout << "FINITE\n";
      return 0;
    }
    if (used[pos] == 1) {
      cout << "INFINITE\n";
      return 0;
    }
    used[pos] = 1;
    if (s[pos] == '>') {
      pos += len[pos];
    } else {
      pos -= len[pos];
    }
  }
  return 0;
}
