#include <bits/stdc++.h>
using namespace std;
int a[100005];
char f[100005];
bool flag[100005];
int main() {
  int n, now = 1;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> f[i];
  for (int i = 1; i <= n; i++) cin >> a[i];
  while (1) {
    if (f[now] == '<') {
      if (now - a[now] < 1 || now - a[now] > n) {
        cout << "FINITE";
        break;
      }
      now -= a[now];
    } else {
      if (now + a[now] < 1 || now + a[now] > n) {
        cout << "FINITE";
        break;
      }
      now += a[now];
    }
    if (flag[now] == 1) {
      cout << "INFINITE";
      break;
    }
    flag[now] = 1;
  }
  return 0;
}
