#include <bits/stdc++.h>
using namespace std;
inline bool cmp(string& a, string& b) { return a.length() < b.length(); }
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> arr(n + 1);
  string str;
  cin >> str;
  int cur = 1;
  for (int i = 1; i < n + 1; i++) cin >> arr[i];
  vector<bool> visit(n + 1);
  while (cur <= n && cur > 0) {
    if (visit[cur] == false) {
      visit[cur] = true;
      if (str[cur - 1] == '>')
        cur = cur + arr[cur];
      else
        cur = cur - arr[cur];
    } else {
      cout << "INFINITE";
      return 0;
    }
  }
  cout << "FINITE";
}
