#include <bits/stdc++.h>
using namespace std;
template <typename T>
vector<T> read(int n) {
  vector<T> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  return v;
}
template <typename T>
void write(const vector<T>& v, const char* c = " ") {
  for (int n = v.size(), i = 0; i < n; ++i) {
    cout << v[i] << (i == n - 1 ? "\n" : c);
  }
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  auto d = read<int>(n);
  set<int> visited;
  int p = 1;
  while (true) {
    if (visited.count(p)) {
      cout << "INFINITE" << endl;
      return;
    }
    visited.insert(p);
    if (s[p - 1] == '<') {
      if (p - d[p - 1] >= 1) {
        p -= d[p - 1];
      } else {
        cout << "FINITE" << endl;
        return;
      }
    } else {
      if (p + d[p - 1] <= n) {
        p += d[p - 1];
      } else {
        cout << "FINITE" << endl;
        return;
      }
    }
  }
}
void configure_ios() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
int main() {
  configure_ios();
  solve();
  return 0;
}
