#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long double E = 1e-10;
char ccc;
inline void read(int &n) {
  n = 0;
  while (true) {
    ccc = getchar();
    if (ccc == ' ' || ccc == '\n') break;
    n = n * 10 + ccc - '0';
  }
}
template <typename T>
inline T sqr(T t) {
  return t * t;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  srand(time(NULL));
  cout.precision(0);
  cout << fixed;
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ar[n];
  for (int i = 0; i < n; i++) cin >> ar[i];
  bool used[n];
  memset(used, 0, sizeof(used));
  int pos = 0;
  while (0 <= pos && pos < n) {
    if (used[pos]) {
      cout << "INFINITE"
           << "\n";
      return 0;
    }
    used[pos] = true;
    if (s[pos] == '<') {
      pos -= ar[pos];
    } else {
      pos += ar[pos];
    }
  }
  cout << "FINITE"
       << "\n";
}
