#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  string s;
  cin >> n;
  cin >> s;
  vector<int> x(n);
  vector<int> vis(n);
  for (int i = 0; i < (int)(n); i++) cin >> x[i];
  int pos = 0;
  while (0 <= pos && pos < n) {
    if (vis[pos]) {
      cout << "INFINITE" << endl;
      return 0;
    }
    vis[pos] = 1;
    if (s[pos] == '>')
      pos += x[pos];
    else
      pos -= x[pos];
  }
  cout << "FINITE" << endl;
  return 0;
}
