#include <bits/stdc++.h>
using namespace std;
int visited[1000001];
int main() {
  int n;
  cin >> n;
  char dir[n];
  int mag[n];
  for (int i = 0; i < n; i++) cin >> dir[i];
  for (int i = 0; i < n; i++) cin >> mag[i];
  for (int i = 0; i < n; i++) visited[i] = 0;
  int cur = 0;
  bool inf = false;
  while (cur >= 0 && cur < n) {
    if (visited[cur]) {
      inf = true;
      break;
    } else {
      visited[cur] = 1;
    }
    if (dir[cur] == '>')
      cur = cur + mag[cur];
    else
      cur = cur - mag[cur];
  }
  if (inf)
    cout << "INFINITE" << endl;
  else
    cout << "FINITE" << endl;
}
