#include <bits/stdc++.h>
using namespace std;
const long long INFLL = numeric_limits<long long>::max();
const long long INFINT = numeric_limits<int>::max();
const long double EPS = 1e-7;
const long long MOD = 1e9 + 7LL;
const long long MAXN = 250000;
long long n;
char to[123456];
long long len[123456];
bool used[123456];
int run() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> to[i];
  for (int i = 0; i < n; i++) cin >> len[i];
  used[0] = true;
  long long cur = 0;
  while (1) {
    if (to[cur] == '>') {
      cur += len[cur];
    } else {
      cur -= len[cur];
    }
    if (cur < 0 || cur >= n) {
      cout << "FINITE";
      return 0;
    }
    if (used[cur]) {
      cout << "INFINITE";
      return 0;
    }
    used[cur] = true;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  if (strcmp("", "") != 0) {
    freopen(
        ""
        ".in",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
  run();
  return 0;
}
