#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  vector<int> arr(n);
  vector<char> used(n, false);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  queue<int> q;
  q.push(0);
  used[0] = 1;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    int cnt = arr[v];
    if (str[v] == '>') {
      v += cnt;
    } else {
      v -= cnt;
    }
    if (v < 0 || v >= n) {
      break;
    }
    if (!used[v]) {
      used[v] = 1;
      q.push(v);
    } else {
      cout << "INFINITE";
      return 0;
    }
  }
  cout << "FINITE";
  return 0;
}
