#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAX = 100005;
bool v[MAX];
int arr[MAX];
int main() {
  int n;
  scanf("%d", &n);
  string x;
  cin >> x;
  x = "." + x;
  for (int i = 1; i < n + 1; i++) {
    cin >> arr[i];
  }
  int i = 1;
  while (1) {
    v[i] = true;
    if (x[i] == '>') {
      i += arr[i];
    } else {
      i -= arr[i];
    }
    if (i <= 0) {
      cout << "FINITE";
      return 0;
    }
    if (i > n) {
      cout << "FINITE";
      return 0;
    }
    if (v[i]) {
      cout << "INFINITE";
      return 0;
    }
  }
}
