#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, pos = 0, inp;
  string s;
  vector<int> v;
  bool yo[100005] = {0};
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> inp;
    v.push_back(inp);
  }
  bool flag = 0;
  while (1) {
    if (pos < 0 || pos >= n) break;
    if (yo[pos]) {
      flag = 1;
      break;
    }
    yo[pos] = 1;
    if (s[pos] == '>')
      pos += v[pos];
    else
      pos -= v[pos];
  }
  if (!flag)
    cout << "FINITE";
  else
    cout << "INFINITE";
  return 0;
}
