#include <bits/stdc++.h>
using namespace std;
int n, a[100001], x = 0;
bool flg = false;
string s;
map<int, int> mp;
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mp[i] = 0;
  }
  while (x >= 0 && x < n) {
    if (mp[x] == 1) {
      flg = true;
      break;
    }
    if (s[x] == '>') {
      mp[x] = 1;
      x += a[x];
    } else {
      mp[x] = 1;
      x -= a[x];
    }
  }
  if (flg)
    cout << "INFINITE" << endl;
  else
    cout << "FINITE" << endl;
  return 0;
}
