#include <bits/stdc++.h>
using namespace std;
bool jumped[100000 + 10];
int main() {
  int n, a[100000 + 10], pos = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  jumped[0] = true;
  while (pos >= 0 && pos < n) {
    if (s[pos] == '>')
      pos += a[pos];
    else
      pos -= a[pos];
    if (pos < 0 || pos >= n) {
      cout << "FINITE";
      return 0;
    }
    if (jumped[pos]) {
      cout << "INFINITE";
      return 0;
    }
    jumped[pos] = true;
  }
}
