#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, i = 0;
  cin >> n >> s;
  std::vector<int> v(n);
  std::vector<bool> cycle(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (i = 0; i < n;) {
    if (i <= -1 || i >= n) break;
    if (cycle[i] == true)
      break;
    else {
      cycle[i] = true;
      if (s[i] == '<')
        i -= v[i];
      else
        i += v[i];
    }
  }
  if (i <= -1 || i >= n)
    cout << "FINITE\n";
  else
    cout << "INFINITE\n";
}
