#include <bits/stdc++.h>
using namespace std;
map<long long, bool> used;
int google = 1;
void add(long long n, long long i) {
  if (n >= 10000000000) return;
  long long r1, r2;
}
bool is_prime(int n) {
  if (n <= 3) return 1;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
long long Gcd(long long a, long long b) { return b == 0 ? a : Gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a * b) / Gcd(a, b); }
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  map<long long, long long> mp;
  map<long long, bool> mp2;
  for (int i = 0; i < n; i++)
    if (s[i] == '>')
      mp[i + 1] = 1;
    else
      mp[i + 1] = 0;
  int i = 1;
  long long num, pos = 1, x = n;
  bool ans = 1;
  while (pos <= n) {
    num = arr[pos - 1];
    mp2[pos] = 1;
    if (mp[pos]) {
      if (num + pos > pos) pos = num + pos;
    } else {
      pos -= num;
      if (pos > n || pos < 1) {
        ans = 0;
        break;
      }
      if (mp2[pos]) {
        ans = 1;
        break;
      } else
        continue;
    }
    if (pos > n || pos < 1) {
      ans = 0;
      break;
    }
  }
  if (ans)
    cout << "INFINITE";
  else
    cout << "FINITE";
}
long long mul(long long n1, long long n2, long long o) {
  return n1 == 1 ? n2 : mul(n1 - 1, n2 + o, o);
}
long long div(long long r, long long n2, long long o) {
  return n2 < 0 ? r - 1 : div(r + 1, n2 - o, o);
}
int main() {
  solve();
  return 0;
}
