#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 1e6 + 6;
int main() {
  int64_t n;
  cin >> n;
  string s;
  cin >> s;
  bool ok[n + 1];
  for (int i = 1; i <= n; i++) ok[i] = false;
  int64_t a[n + 1];
  for (int64_t i = 0; i < n; i++) cin >> a[i + 1];
  int64_t i = 1;
  for (int j = 0; j < 1000000; j++) {
    if (ok[i]) {
      cout << "INFINITE"
           << "\n";
      exit(0);
    }
    ok[i] = true;
    if (s[i - 1] == '<') {
      if (i - a[i] <= 0) {
        cout << "FINITE"
             << "\n";
        exit(0);
      }
      i -= a[i];
    } else {
      if (i + a[i] > n) {
        cout << "FINITE"
             << "\n";
        exit(0);
      }
      i += a[i];
    }
  }
  cout << "INFINITE"
       << "\n";
  return 0;
}
