#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n = 0;
  cin >> n;
  string s;
  cin >> s;
  int pos = 0;
  vector<int> v(n);
  int flag = 1;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < n; i++) {
    if (s[pos] == '>') {
      pos += v[pos];
    } else {
      pos -= v[pos];
    }
    if (pos < 0 || pos > n - 1) {
      cout << "FINITE";
      flag = 0;
      break;
    }
  }
  if (flag == 1) {
    cout << "INFINITE";
  }
  return 0;
}
