#include <bits/stdc++.h>
using namespace std;
void processSteps(int N, string steps, vector<int>& step_size) {
  const char* step_str = steps.c_str();
  int cur_loc = 0;
  vector<int> visited(N);
  while (true) {
    if (visited[cur_loc] == 1) {
      cout << "INFINITE" << endl;
      return;
    }
    visited[cur_loc] = 1;
    if (step_str[cur_loc] == '<') {
      step_size[cur_loc] *= -1;
    }
    cur_loc += step_size[cur_loc];
    if (cur_loc < 0 || cur_loc >= N) {
      cout << "FINITE" << endl;
      return;
    }
  }
}
int main() {
  string N_s;
  getline(cin, N_s);
  int N = atoi(N_s.c_str());
  string S;
  getline(cin, S);
  string steps;
  getline(cin, steps);
  vector<int> steps_vec;
  stringstream stream(steps);
  int tmp;
  while (stream >> tmp) steps_vec.push_back(tmp);
  processSteps(N, S, steps_vec);
  return 0;
}
