#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 19;
const long long inf = 99999999999;
const long double PI = 3.14159265359;
const int mod = 1e9 + 7;
string s;
long long a[N], n;
set<long long> st;
inline void ans(long long j);
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  ans(0);
  return 0;
}
inline void ans(long long j) {
  if (j < 0 || j >= n) {
    cout << "FINITE" << endl;
    exit(0);
  }
  if (st.count(j)) {
    cout << "INFINITE" << endl;
    exit(0);
  }
  st.insert(j);
  if (s[j] == '<')
    ans(j - a[j]);
  else
    ans(j + a[j]);
}
