#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000 + 5;
int d[MAX_N];
bool visited[MAX_N];
int main() {
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  string S;
  cin >> S;
  for (int i = 1; i <= N; ++i) cin >> d[i];
  int cell = 1;
  while (true) {
    if (cell < 1 || cell > N) {
      cout << "FINITE\n";
      return 0;
    }
    if (visited[cell]) {
      cout << "INFINITE\n";
      return 0;
    }
    visited[cell] = true;
    if (S[cell - 1] == '>')
      cell += d[cell];
    else
      cell -= d[cell];
  }
  return 0;
}
