#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  string str;
  cin >> str;
  long long prev = 0;
  vector<long long> a(n);
  for (int i = 0; i < n; i += 1) cin >> a[i];
  long long x = 2 * n, i = 0;
  while (x--) {
    if (str[i] == '>') {
      prev = i;
      i += a[i];
      if (i >= n) {
        cout << "FINITE" << endl;
        break;
        return 0;
      }
      if (a[prev] == a[i] && str[i] == '<') {
        cout << "INFINITE" << endl;
        break;
        return 0;
      }
    } else {
      prev = i;
      i -= a[i];
      if (i < 0) {
        cout << "FINITE" << endl;
        break;
        return 0;
      }
      if (a[prev] == a[i] && str[i] == '>') {
        cout << "INFINITE" << endl;
        break;
        return 0;
      }
    }
  }
  if (x < 0) cout << "INFINITE";
  return 0;
}
