#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, in = 0, prev = -1, check = 0, temp = -1;
  cin >> n;
  int d[n];
  int a[100005] = {0};
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  while (in < n && in > -1) {
    if (a[in]) {
      check = 1;
      break;
    }
    a[in] = 1;
    if (s[in] == '>') {
      in += d[in];
    } else {
      in -= d[in];
    }
  }
  if (check == 0) {
    cout << "FINITE";
  } else {
    cout << "INFINITE";
  }
  return 0;
}
