#include <bits/stdc++.h>
using namespace std;
int ans, n;
string str;
char ch[101000];
int a[101000];
void init() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ch[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
}
void work() {
  int ti = 0;
  for (int i = 1; ti <= n; ti++) {
    if (ch[i] == '>')
      i += a[i];
    else if (ch[i] == '<') {
      i -= a[i];
    }
    if (i < 1 || i > n) {
      cout << "FINITE" << endl;
      return;
    }
  }
  cout << "INFINITE" << endl;
}
int main() {
  init();
  work();
  return 0;
}
