#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n, p = 1, k[int(1e5)], i, j, x, b;
  char s[int(1e5)];
  cin >> n;
  for (i = 0; i < n; i++) cin >> s[i];
  for (i = 0; i < n; i++) cin >> k[i];
  int pos = 0;
  for (int i = 0; i < 1000000; i++) {
    if (s[pos] == '>')
      pos += k[pos];
    else
      pos -= k[pos];
    if (pos < 0 || n <= pos) break;
  }
  puts((0 <= pos && pos < n) ? "INFINITE" : "FINITE");
  return 0;
}
