#include <bits/stdc++.h>
using namespace std;
int op[100010], len[100010];
int n;
bool vis[100010];
int main() {
  memset(vis, 0, sizeof(vis));
  int n;
  cin >> n;
  string str;
  cin >> str;
  for (int i = 0; i < n; i++) {
    op[i] = (str[i] == '>');
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &len[i]);
  }
  for (int i = 0;;) {
    if (vis[i]) {
      cout << "INFINITE" << endl;
      return 0;
    } else {
      int ii = op[i] ? i + len[i] : i - len[i];
      if ((ii >= 0 && ii < n)) {
        vis[i] = 1;
        i = ii;
      } else {
        cout << "FINITE" << endl;
        return 0;
      }
    }
  }
  cout << "FINITE" << endl;
  return 0;
}
