#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 1;
const long long int mod2 = 1e9 + 9;
const long long int maxn = 1e6 + 1;
const int root = 1e7 + 5;
const long long inf = 1e18 + 18;
double pie4 = 3.1415926535;
long long int visit[maxn], a[maxn];
void die() {
  cout << "INFINITE";
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, i, pos;
  string s;
  cin >> n;
  cin >> s;
  for (i = 0; i < n; i++) cin >> a[i];
  pos = 0;
  visit[0] = 0;
  while (1) {
    if (s[pos] == '>') {
      pos += a[pos];
      if (pos >= n || pos < 0) {
        cout << "FINITE";
        return 0;
      }
      if (visit[pos]) die();
      visit[pos] = 1;
    } else {
      pos -= a[pos];
      if (pos >= n || pos < 0) {
        cout << "FINITE";
        return 0;
      }
      if (visit[pos]) die();
      visit[pos] = 1;
    }
    if (pos >= n || pos < 0) {
      cout << "FINITE";
      return 0;
    }
  }
}
