#include <bits/stdc++.h>
using namespace std;
void local() {}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  local();
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long int> a(n);
  for (auto &i : a) {
    cin >> i;
  }
  set<long long int> visited;
  long long int flag = 1;
  long long int ind = 0;
  for (long long int i = 0; i < n;) {
    if (s[i] == '>') {
      i += a[i];
      if (i >= n) {
        break;
      }
    } else {
      i -= a[i];
      if (i < 0) {
        break;
      }
    }
    if (visited.count(i) > 0) {
      flag = 0;
      break;
    }
    visited.insert(i);
  }
  cout << (flag ? "FINITE" : "INFINITE");
  return 0;
}
