#include <bits/stdc++.h>
using namespace std;
bool vis[100009];
int n;
pair<bool, int> arr[100009];
bool ret;
bool fun1(int pos) {
  if (pos >= 1 && pos <= n) {
    return 1;
  }
  ret = 1;
  return 0;
}
int main() {
  string str;
  cin >> n >> str;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i].second;
    arr[i].first = (str[i - 1] == '>');
  }
  int pos = 1;
  while (fun1(pos) && !vis[pos]) {
    vis[pos] = 1;
    if (arr[pos].first == 1)
      pos += arr[pos].second;
    else
      pos -= arr[pos].second;
  }
  (!ret) ? puts("INFINITE") : puts("FINITE");
}
