#include <bits/stdc++.h>
using namespace std;
long long a[100000];
bool b[100000];
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  b[0] = 1;
  for (long long i = 0;;) {
    if (s[i] == '>')
      i += a[i];
    else
      i -= a[i];
    if (i > n - 1 || i < 0) {
      cout << "FINITE";
      break;
    }
    if (b[i] == 1) {
      cout << "INFINITE";
      break;
    } else
      b[i] = 1;
  }
  return 0;
}
