#include <bits/stdc++.h>
using namespace std;
int n, d[100005], g[100005];
bool vis[100005];
char str[100005];
void get() {
  bool sign = 1;
  int cur = 1;
  while (cur >= 1 && cur <= n) {
    if (vis[cur]) {
      sign = 0;
      break;
    }
    vis[cur] = 1;
    cur += g[cur] * d[cur];
  }
  if (!sign)
    cout << "INFINITE" << endl;
  else
    cout << "FINITE" << endl;
}
int main() {
  cin >> n >> str + 1;
  for (int i = 1; i <= n; i++) cin >> d[i];
  for (int i = 1; i <= n; i++) g[i] = str[i] == '>' ? 1 : -1;
  get();
  return 0;
}
