#include <bits/stdc++.h>
using namespace std;
const long long BIG_INT = 1e6 + 3;
int main() {
  cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false);
  long long n;
  string s;
  cin >> n >> s;
  vector<int> a(n);
  vector<bool> was(n, false);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (s[i] == '<') a[i] *= -1;
  }
  int j = 0;
  for (int i = 0; i < n; i++) {
    j += a[j];
    if (j < 0 || j >= n) {
      cout << "FINITE";
      return 0;
    }
    if (was[j]) {
      cout << "INFINITE";
      return 0;
    }
    was[j] = true;
  }
  cout << "INFINITE";
  return 0;
}
