#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> d(n);
  vector<bool> a(n, true);
  for (int i = 0; i < n; i++) cin >> d[i];
  int p = 0;
  while (true) {
    if (p < 0 || p >= n) {
      cout << "FINITE" << endl;
      break;
    }
    if (!a[p]) {
      cout << "INFINITE" << endl;
      break;
    }
    a[p] = false;
    if (s[p] == '>')
      p += d[p];
    else
      p -= d[p];
  }
  return 0;
}
