#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  char dir[100005];
  int len[100005];
  int i;
  int cell[100005] = {0};
  for (i = 1; i <= n; i++) cin >> dir[i];
  for (i = 1; i <= n; i++) cin >> len[i];
  int flag = 0;
  i = 1;
  while (cell[i] == 0) {
    if (dir[i] == '>') {
      if (i + len[i] > n) {
        flag = 1;
        break;
      } else {
        cell[i]++;
        i = i + len[i];
      }
    } else if (dir[i] == '<') {
      if (i - len[i] < 1) {
        flag = 1;
        break;
      } else {
        cell[i] = 1;
        i = i - len[i];
      }
    }
  }
  if (!flag)
    cout << "INFINITE\n";
  else
    cout << "FINITE\n";
}
