#include <bits/stdc++.h>
using namespace std;
void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
const int N = (int)1e5 + 10;
int n, ile[N];
bool vis[N], flag = true;
char z[N];
void dfs(int v) {
  vis[v] = true;
  if (z[v] == '>')
    v += ile[v];
  else
    v -= ile[v];
  if (v < 1 || v > n) {
    flag = false;
    return;
  }
  if (!vis[v]) dfs(v);
}
int main() {
  init_ios();
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> z[i];
  for (int i = 1; i <= n; ++i) cin >> ile[i];
  dfs(1);
  if (flag)
    cout << "INFINITE\n";
  else
    cout << "FINITE\n";
}
