#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MAXW = 1e5 + 1;
long long n, m;
bool ispal(string s) {
  int start = 0, end = s.size() - 1;
  while (start < end) {
    if (s[start] == s[end]) {
      end--;
      start++;
    } else {
      return false;
    }
  }
  return true;
}
using namespace std;
int main() {
  long long n;
  string s;
  cin >> n >> s;
  vector<int> v(n, 0);
  vector<int> val(n, 0);
  unordered_set<long long> visited;
  for (int i = 0; i < n; i++) {
    cin >> val[i];
    if (s[i] == '<') {
      v[i] = 1;
    }
  }
  long long i = 0;
  while (i >= 0 && i < n) {
    visited.insert(i);
    if (v[i] == 1)
      i -= val[i];
    else if (v[i] == 0)
      i += val[i];
    if (visited.find(i) != visited.end()) {
      cout << "INFINITE\n";
      return 0;
    }
  }
  cout << "FINITE\n";
  cout << endl;
  return 0;
}
