#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {-1, 1, 0, 0, -1, -1, 1, 1};
const int mod = 1000000007;
const double pi = acos(-1);
const int OO = INT_MAX;
const int N = 1e6;
bool u[100000 + 1];
int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> ar(n);
  for (int i = 0; i < n; i++) cin >> ar[i];
  int i = 0;
  while (1) {
    if (u[i]) return cout << "INFINITE", 0;
    u[i] = 1;
    if (s[i] == '>') {
      if (i + ar[i] >= n)
        return cout << "FINITE", 0;
      else
        i += ar[i];
    } else if (s[i] == '<') {
      if (i - ar[i] < 0)
        return cout << "FINITE", 0;
      else
        i -= ar[i];
    }
  }
  cout << "FINITE";
}
