#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5;
int d[maxn];
int w[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    cin >> d[i];
  }
  int cur = 0;
  while (cur >= 0 && cur < n && !w[cur]) {
    w[cur] = 1;
    cur = cur + (s[cur] == '<' ? -1 : 1) * d[cur];
  }
  if (cur < 0 || cur >= n) {
    cout << "FINITE\n";
  } else {
    cout << "INFINITE\n";
  }
  return 0;
}
