#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int* arr;
  char* ch;
  bool* flag;
  while (cin >> n) {
    arr = new int[n];
    ch = new char[n];
    flag = new bool[n];
    for (int i = 0; i < n; i++) flag[i] = false;
    for (int i = 0; i < n; i++) cin >> ch[i];
    for (int i = 0; i < n; ++i) cin >> arr[i];
    int no = 0;
    bool over = false;
    while (true) {
      if (flag[no]) {
        over = true;
        break;
      }
      flag[no] = true;
      if (ch[no] == '>') {
        no = no + arr[no];
        if (no > n - 1) break;
      } else if (ch[no] == '<') {
        no = no - arr[no];
        if (no < 0) break;
      }
    }
    if (!over)
      printf("FINITE\n");
    else
      printf("INFINITE\n");
  }
  return 0;
}
