#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, x = 0;
  cin >> n;
  string s;
  cin >> s;
  int a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i <= n; ++i) {
    if (x < 0 || x >= n) {
      printf("FINITE");
      return 0;
    }
    s[x] == '>' ? x += a[x] : x -= a[x];
  }
  printf("INFINITE");
  return 0;
}
