#include <bits/stdc++.h>
using namespace std;
char c[100000];
int s[100000];
int main() {
  int n;
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  int ind = 0;
  if (ind == 0) {
    if (c[ind] == '>') {
      c[ind] = '0';
      ind += s[ind];
    } else if (c[ind] == '<') {
      c[ind] = '0';
      ind -= s[ind];
    } else {
      cout << "INFINITE" << endl;
      return 0;
    }
  }
  while (ind < n && ind > 0) {
    if (c[ind] == '0') {
      cout << "INFINITE" << endl;
      return 0;
    }
    if (c[ind] == '>') {
      c[ind] = '0';
      ind += s[ind];
    } else if (c[ind] == '<') {
      c[ind] = '0';
      ind -= s[ind];
    }
  }
  if (ind <= 0 || ind >= n) {
    if (ind == 0) {
      if (c[ind] == '0') {
        cout << "INFINITE" << endl;
        return 0;
      }
    }
    cout << "FINITE" << endl;
    return 0;
  } else {
    cout << "INFINITE" << endl;
    return 0;
  }
}
