#include <bits/stdc++.h>
const int N = 1e5 + 3;
const int inf = 1e9;
using namespace std;
char s[N];
int a[N];
bool us[N];
bool solve() {
  int n;
  scanf("%d%s", &n, s);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  int k = 0;
  for (;;) {
    k += (s[k] == '>' ? a[k] : -a[k]);
    if (k < 0 || k >= n) {
      puts("FINITE");
      return 0;
    }
    if (us[k]) break;
    us[k] = 1;
  }
  puts("INFINITE");
  return false;
}
int main() {
  solve();
  return 0;
}
