#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int64_t n, r = 0, ch = 0;
  cin >> n;
  int64_t m[n];
  char x[111111];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> m[i];
  }
  for (int i = 0; i <= n; i++) {
    if (r >= n || r < 0) {
      cout << "FINITE" << endl;
      ch = 1;
      break;
    }
    if (x[r] == '>') {
      r += m[r];
    } else {
      r -= m[r];
    }
  }
  if (ch == 0) {
    cout << "INFINITE" << endl;
  }
}
