#include <bits/stdc++.h>
using namespace std;
int ar[100001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, cur = 0;
  string s;
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (int i = 0; i < 10000000; i++) {
    if (s[cur] == '<') {
      cur -= ar[cur];
    } else {
      cur += ar[cur];
    }
    if (cur < 0 || cur >= n) {
      cout << "FINITE";
      return 0;
    }
  }
  cout << "INFINITE";
  return 0;
}
