#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
const double eps = 1e-9;
int ts, kk = 1;
int n;
char s[500005];
char qs[] = {"><"};
long long int ls[] = {1LL, -1LL};
int a[500005];
bool vs[500005];
int main() {
  int t, i, j, k;
  long long int x = 1;
  scanf("%d %s", &n, s);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  while (vs[x] == 0) {
    for (k = 0; k < 2; k++)
      if (s[x - 1] == qs[k]) break;
    vs[x] = 1;
    x += ls[k] * a[x - 1];
    if (x < 1 || x > n) {
      printf("FINITE\n");
      return 0;
    }
  }
  printf("INFINITE\n");
  return 0;
}
