#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
pair<T1, T2> operator+(pair<T1, T2> a, pair<T1, T2> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
template <typename T1, typename T2>
pair<T1, T2> operator-(pair<T1, T2> a, pair<T1, T2> b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> p) {
  out << p.first << " " << p.second;
  return out;
}
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> v) {
  for (auto a : v) out << a << " ";
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& v) {
  for (auto& a : v) in >> a;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, multiset<T> S) {
  for (auto a : S) out << a << " ";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, set<T> S) {
  for (auto a : S) out << a << " ";
  return out;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, map<T1, T2>& M) {
  for (auto m : M) out << "[" << m.first << "]=" << m.second << " ";
  return out;
}
map<string, int> ID;
int getID(string str) {
  transform(str.begin(), str.end(), str.begin(), ::tolower);
  if (ID.find(str) == ID.end()) {
    ID.insert(make_pair(str, ID.size()));
  }
  return ID[str];
}
int n;
vector<vector<int> > E;
vector<int> V;
vector<int> D;
vector<int> F;
vector<int> A;
int tick;
void dfs(int s) {
  if (V[s]) return;
  V[s] = 1;
  D[s] = tick++;
  A[s] = 1;
  for (auto t : E[s]) {
    if (!V[t]) {
      dfs(t);
      A[s] = max(A[s], A[t] + 1);
    } else if (V[t] == 2) {
      A[s] = max(A[s], A[t] + 1);
    }
  }
  V[s] = 2;
  F[s] = tick++;
}
int process() {
  n = E.size();
  V.assign(n, 0);
  D.resize(n);
  F.resize(n);
  A.resize(n);
  tick = 0;
  for (int i = 0; i < n; i++) dfs(i);
  return *max_element(A.begin(), A.end());
}
int main() {
  int n;
  cin >> n;
  string str;
  vector<int> v(n);
  cin >> str >> v;
  int pos = 0;
  set<int> S;
  bool finite = true;
  while (0 <= pos && pos < n) {
    if (S.insert(pos).second == false) {
      finite = false;
      break;
    }
    if (str[pos] == '<')
      pos -= v[pos];
    else
      pos += v[pos];
  }
  if (finite)
    cout << "FINITE" << endl;
  else
    cout << "INFINITE" << endl;
  return 0;
}
