#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000 + 9;
const long long MOD = 1000 * 1000 * 1000 + 7;
const long double EPS = 1e-9;
const int N = 100005;
int n;
string s;
int a[N];
char p[N];
int main() {
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int i = 0;
  while (i >= 0 && i < n && !p[i]) {
    p[i] = true;
    i += (s[i] == '>' ? 1 : -1) * a[i];
  }
  if (i >= 0 && i < n) {
    cout << "INFINITE";
  } else {
    cout << "FINITE";
  }
  return 0;
}
