#include <bits/stdc++.h>
using namespace std;
long long int b[200005];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n;
  string second;
  cin >> n >> second;
  long long int a[n], k = 0, flag = 0;
  for (long long int i = 0; i < n; i++) cin >> a[i];
  while (b[k] == 0) {
    b[k] = 1;
    if (second[k] == '<')
      k -= a[k];
    else
      k += a[k];
    if (k < 0 || k >= n) {
      flag = 1;
      break;
    }
  }
  if (flag)
    cout << "FINITE";
  else
    cout << "INFINITE";
}
