#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 5;
int32_t main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int curr = 0;
  bool vis[n];
  for (int i = 1; i < n; i++) {
    vis[i] = 0;
  }
  vis[0] = 1;
  while (1) {
    if (s[curr] == '>') {
      curr += a[curr];
    } else if (s[curr] == '<') {
      curr -= a[curr];
    }
    if (curr >= n || curr < 0) {
      cout << "FINITE" << endl;
      return 0;
    }
    if (vis[curr] == 1) {
      cout << "INFINITE" << endl;
      return 0;
    }
    vis[curr] = 1;
  }
  return 0;
}
