#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double pi = acos(-1.0), eps = 1e-9;
const int INF = 1000 * 1000 * 1000, MAXN = 100005, MOD = INF + 7;
int n, d[MAXN];
string s;
void solve() {
  cin >> n >> s;
  for (int i = 0; i < n; ++i) cin >> d[i];
  int cur = 0;
  for (int iter = 0; iter < 10 * n; iter++) {
    if (s[cur] == '>')
      cur += d[cur];
    else
      cur -= d[cur];
    if (cur < 0 || cur >= n) {
      cout << "FINITE";
      return;
    }
  }
  cout << "INFINITE";
}
int main() {
  solve();
  return 0;
}
