#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<char> dir(n);
  for (int i = 0; i < n; i++) {
    cin >> dir[i];
  }
  vector<int> len(n);
  for (int i = 0; i < n; i++) {
    cin >> len[i];
  }
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    v[i] = len[i];
    if (dir[i] == '<') v[i] *= -1;
  }
  unordered_set<int> visited;
  visited.insert(0);
  int cur = 0;
  for (;;) {
    cur += v[cur];
    if (cur < 0 || cur >= n) {
      cout << "FINITE" << endl;
      return 0;
    }
    if (visited.find(cur) != visited.end()) {
      cout << "INFINITE" << endl;
      return 0;
    }
    visited.insert(cur);
  }
}
