#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int inf = 2000000000;
int d[N];
bool was[N];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
  }
  int first = 1;
  while (first >= 1 && first <= n) {
    if (was[first]) {
      cout << "INFINITE\n";
      return 0;
    }
    was[first] = true;
    if (s[first - 1] == '>') {
      first += d[first];
    } else {
      first -= d[first];
    }
  }
  cout << "FINITE\n";
}
