#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> v;
  int c = 1;
  v.push_back(c);
  bool x = true;
  while (true) {
    if (s[c - 1] == '>')
      c += a[c - 1];
    else
      c -= a[c - 1];
    if (c < 1 || c > n) break;
    vector<int>::iterator j = find(v.begin(), v.end(), c);
    if (j != v.end()) {
      x = false;
      break;
    } else {
      v.push_back(c);
    }
  }
  if (x == true)
    cout << "FINITE" << endl;
  else
    cout << "INFINITE" << endl;
}
