#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int a[100000];
bool used[100000];
void dfs(int v) {
  used[v] = 1;
  int val = a[v];
  if (s[v] == '<') val = -val;
  int nextV = val + v;
  if (nextV < 0 || nextV >= n) {
    cout << "FINITE\n";
    exit(0);
  }
  if (used[nextV]) {
    cout << "INFINITE\n";
    exit(0);
  }
  dfs(nextV);
}
int main() {
  ios_base::sync_with_stdio(0);
  fill(used, used + 100000, 0);
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  dfs(0);
  return 0;
}
