#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long> v;
  long long x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  long long st = 0;
  for (int i = 0; i <= 4 * 1e7; i++) {
    if (s[st] == '>') {
      st += v[st];
    } else {
      st -= v[st];
    }
    if (st < 0 || st >= n) {
      cout << "FINITE" << endl;
      return 0;
    }
  }
  cout << "INFINITE" << endl;
  return 0;
}
