#include <bits/stdc++.h>
using namespace std;
vector<int> G[100100];
bool b[100100], out[100100], v[100100];
bool dfs(int u) {
  if (out[u]) {
    cout << "FINITE\n";
    exit(0);
  }
  v[u] = true;
  for (int i = 0; i < (int)G[u].size(); ++i) {
    if (!v[G[u][i]]) {
      dfs(G[u][i]);
    }
  }
}
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i)
    if (s[i] == '>') b[i] = true;
  long long d;
  for (int i = 0; i < n; ++i) {
    cin >> d;
    d = i + b[i] * d + (!b[i]) * d * -1;
    if (d >= 0 && d < n)
      G[i].push_back(d);
    else
      out[i] = true;
  }
  dfs(0);
  cout << "INFINITE\n";
}
