#include <bits/stdc++.h>
using namespace std;
long long int n, i, j, h, d[100001];
string s;
bool used[100001];
int main() {
  cin >> n;
  cin >> s;
  for (i = 0; i < n; i++) cin >> d[i];
  long long int x = 0;
  while (x >= 0 && x < n) {
    if (used[x]) {
      cout << "INFINITE" << endl;
      return 0;
    }
    used[x] = true;
    if (s[x] == '>')
      x += d[x];
    else
      x -= d[x];
  }
  cout << "FINITE" << endl;
}
