#include <bits/stdc++.h>
using namespace std;
long long a[100000 + 1];
long long ans[100000 + 1];
char ch[100000 + 1];
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    ans[i] = 0;
    cin >> ch[i];
  }
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    if (ch[i] == '>' && a[i] > n - i) ans[i] = -1;
    if (ch[i] == '<' && a[i] >= i) ans[i] = -1;
  }
  long long curr = 1;
  while (true) {
    if (ans[curr] == 1) {
      cout << "INFINITE" << endl;
      return 0;
    }
    if (ans[curr] == -1) {
      cout << "FINITE" << endl;
      return 0;
    }
    ans[curr] = 1;
    if (ch[curr] == '>')
      curr += a[curr];
    else
      curr -= a[curr];
  }
}
