#include <bits/stdc++.h>
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T cube(T x) {
  return x * x * x;
}
using namespace std;
int n;
string s;
int a[int(1e5 + 100)];
bool check[int(1e5 + 100)];
int main() {
  cin >> n;
  cin >> s;
  for (int i = (0); i <= (n - 1); i++) scanf("%d", &a[i]);
  int pos = 0;
  check[pos] = true;
  bool isInf = true;
  for (int i = (0); i <= (n - 1); i++) {
    if (s[pos] == '>')
      pos += a[pos];
    else
      pos -= a[pos];
    if (pos < 0) {
      isInf = false;
      break;
    }
    if (pos >= n) {
      isInf = false;
      break;
    }
    if (check[pos]) break;
    check[pos] = true;
  }
  if (isInf)
    cout << "INFINITE";
  else
    cout << "FINITE";
}
