#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int i;
  cin >> n;
  char *dire = (char *)malloc(n * sizeof(char));
  int *jump = (int *)malloc(n * sizeof(int));
  int *a = (int *)malloc(n * sizeof(int));
  for (i = 0; i < n; i++) cin >> dire[i];
  for (i = 0; i < n; i++) cin >> jump[i];
  for (i = 0; i < n; i++) a[i] = 0;
  i = 0;
  while (1) {
    if (dire[i] == '>') {
      i = i + jump[i];
      if (i >= n) {
        cout << "FINITE" << endl;
        break;
      } else if (a[i] != 0) {
        cout << "INFINITE" << endl;
        break;
      } else
        a[i]++;
    } else {
      i = i - jump[i];
      if (i < 0) {
        cout << "FINITE" << endl;
        break;
      } else if (a[i] != 0) {
        cout << "INFINITE" << endl;
        break;
      } else
        a[i]++;
    }
  }
  return 0;
}
