#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> d(n);
  copy_n(istream_iterator<int>(cin), n, d.begin());
  vector<bool> used(n, false);
  int cur = 0;
  while (0 <= cur and cur < n and !used[cur]) {
    used[cur] = true;
    if (s[cur] == '<')
      cur -= d[cur];
    else
      cur += d[cur];
  }
  if (0 <= cur and cur < n) cout << "IN";
  cout << "FINITE" << endl;
}
