#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(7);
  int n;
  std::string s;
  std::cin >> n >> s;
  std::vector<int> d(n);
  for (size_t i = 0; i < n; i++) {
    cin >> d[i];
  }
  int cur = 0;
  for (size_t i = 0; i < n + 2; i++) {
    if (s[cur] == '<') {
      cur -= d[cur];
    } else {
      cur += d[cur];
    }
    if (cur < 0 || cur >= n) {
      std::cout << "FINITE" << std::endl;
      return 0;
    }
  }
  std::cout << "INFINITE" << std::endl;
  return 0;
}
