#include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long p, long long m) {
  long long r = 1;
  while (p) {
    if (p & 1) r = r * a % m;
    p >>= 1;
    a = a * a % m;
  }
  return r;
}
const int MaxN = 1e5 + 55;
const long long INF = 1e10 + 10;
const long long MOD = 1e9 + 7;
int n, d[MaxN], vis[MaxN] = {0};
string s;
int dir(char ch) { return (ch == '<' ? -1 : 1); }
int main() {
  int pos = 0;
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> d[i];
  while (pos < n && pos >= 0 && !vis[pos]) {
    vis[pos] = 1;
    pos += dir(s[pos]) * d[pos];
  }
  if (pos >= n || pos < 0)
    cout << "FINITE";
  else
    cout << "INFINITE";
}
