#include <bits/stdc++.h>
using namespace std;
const int INF = 2 * int(1e9);
const long long INFll = 1ll * int(1e9) * int(1e9);
const int MOD = 1000000007;
template <class T>
istream& operator>>(istream& in, vector<T>& a) {
  for (int i = 0; i < a.size(); ++i) in >> a[i];
  return in;
}
template <class T>
ostream& operator<<(ostream& out, vector<T>& a) {
  for (int i = 0; i < a.size(); ++i)
    if (i == a.size() - 1)
      out << a[i];
    else
      out << a[i] << " ";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, vector<pair<T, T> >& a) {
  for (int i = 0; i < a.size(); ++i)
    out << a[i].first << " " << a[i].second << endl;
  return out;
}
template <class T>
istream& operator>>(istream& in, vector<pair<T, T> >& a) {
  for (int i = 0; i < a.size(); ++i) in >> a[i].first >> a[i].second;
  return in;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> d(n);
  cin >> d;
  vector<int> used(n);
  used[0] = 1;
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    int dir = 1;
    if (s[v] == '<') dir = -1;
    if (dir * d[v] + v < 0 || dir * d[v] + v >= n) {
      cout << "FINITE";
      return 0;
    }
    if (used[v + dir * d[v]]) {
      cout << "INFINITE";
      return 0;
    }
    used[v + dir * d[v]] = 1;
    q.push(v + dir * d[v]);
  }
  if (0)
    cerr << fixed << setprecision(0)
         << "TIME = " << clock() / (long double)CLOCKS_PER_SEC * 1000 << "\n";
  return 0;
}
