#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
char s[100005];
bool vis[100005];
int len[100005];
int main() {
  int n, i, pos;
  bool finit;
  scanf("%d", &n);
  scanf("%s", s);
  for (i = 0; i < n; i++) {
    scanf("%d", &len[i]);
    vis[i] = false;
  }
  finit = false;
  vis[0] = true;
  pos = 0;
  while (true) {
    if (s[pos] == '<')
      pos -= len[pos];
    else
      pos += len[pos];
    if (pos < 0 || pos >= n) {
      finit = true;
      break;
    }
    if (vis[pos]) {
      break;
    }
    vis[pos] = true;
  }
  if (finit)
    cout << "FINITE\n";
  else
    cout << "INFINITE\n";
  return 0;
}
