#include <bits/stdc++.h>
using namespace std;
int dir[(int)1e6];
int jump[(int)1e6];
bool visited[(int)1e6] = {0};
int n;
int dfs(int i) {
  if (i <= 0 || i > n) return 1;
  if (visited[i] == 1) return 0;
  visited[i] = 1;
  if (dir[i] == 1) {
    return dfs(i + jump[i]);
  } else if (dir[i] == -1) {
    return dfs(i - jump[i]);
  }
}
int main(int argc, char const *argv[]) {
  cin >> n;
  string s;
  cin >> s;
  for (int(i) = (0); (i) <= (s.size() - 1); ++(i)) {
    if (s[i] == '<')
      dir[i + 1] = -1;
    else
      dir[i + 1] = 1;
  }
  for (int(i) = (1); (i) <= (n); ++(i)) {
    cin >> jump[i];
  }
  int ans = dfs(1);
  if (ans == 1)
    cout << "FINITE\n";
  else
    cout << "INFINITE\n";
  return 0;
}
