#include <bits/stdc++.h>
using namespace std;
long long power(int x, int y) {
  if (y == 0)
    return 1;
  else if (y & 1)
    return x * power(x, y / 2) * power(x, y / 2);
  else
    return power(x, y / 2) * power(x, y / 2);
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n, k;
  string s;
  cin >> n >> s;
  int r[n];
  for (int i = 0; i < n; i += 1) cin >> r[i];
  for (int i = 0; i < n + 1; i += 1) {
    if (k < 0 || k >= n) {
      cout << "FINITE";
      return 0;
    }
    if (s[k] == '>')
      k = k + r[k];
    else
      k = k - r[k];
  }
  cout << "INFINITE";
  return 0;
}
