#include <bits/stdc++.h>
inline void in(int &MAGNUS) { scanf("%d", &MAGNUS); }
inline void out(int MAGNUS) { printf("%d\n", MAGNUS); }
inline void in(int &MAGNUS, int &CLAR) { scanf("%d%d", &MAGNUS, &CLAR); }
inline void out(int MAGNUS, int CLAR) { printf("%d %d\n", MAGNUS, CLAR); }
inline void inl(long long &LIV) { scanf("%lld", &LIV); }
inline void inl(long long &LIV, long long &MART) {
  scanf("%lld%lld", &LIV, &MART);
}
inline void outl(long long LIV) { printf("%lld\n", LIV); }
inline void outl(long long LIV, long long MART) {
  printf("%lld %lld\n", LIV, MART);
}
using namespace std;
char d[100005];
int l[100005];
bool vis[100005];
int main() {
  int N;
  in(N);
  for (int i = 1; i <= N; i++) cin >> d[i];
  for (int i = 1; i <= N; i++) cin >> l[i];
  int pos = 1;
  vis[1] = 1;
  while (1) {
    if (d[pos] == '>')
      pos += l[pos];
    else
      pos -= l[pos];
    if (pos < 1 || pos > N) {
      puts("FINITE");
      return 0;
    }
    if (vis[pos]) {
      puts("INFINITE");
      return 0;
    }
    vis[pos] = 1;
  }
  return 0;
}
