#include <bits/stdc++.h>
using namespace std;
int used[100001];
int main() {
  int n;
  cin >> n;
  char s[n + 2];
  int a[n + 2];
  for (int i = 1; i <= n; i++) cin >> s[i];
  for (int i = 1; i <= n; i++) cin >> a[i];
  int i = 1;
  int m;
  int k = 1;
  while (k == 1) {
    m = i;
    if (used[i] == 0) {
      if (s[i] == '<') {
        if (i - a[i] <= 0) {
          cout << "FINITE";
          return 0;
        }
        if (i - a[i] > 0) {
          i -= a[i];
        }
      }
      if (s[i] == '>') {
        if (i + a[i] > n) {
          cout << "FINITE";
          return 0;
        } else
          i += a[i];
      }
    } else {
      cout << "INFINITE";
      return 0;
    }
    used[m] = 1;
  }
  return 0;
}
