#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char x[n + 1];
  int d[n + 1];
  for (int i = 1; i <= n; i++) cin >> x[i];
  for (int i = 1; i <= n; i++) cin >> d[i];
  int a = 1;
  bool check = true;
  for (int i = 0; i < n; i++) {
    if (x[a] == '>')
      a += d[a];
    else
      a -= d[a];
    if (a <= 0 || a > n) {
      check = false;
      break;
    }
  }
  if (check == true)
    cout << "INFINITE" << endl;
  else
    cout << "FINITE" << endl;
}
