#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long n;
  cin >> n;
  vector<pair<char, long long>> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
  }
  for (long long i = 0; i < n; i++) {
    cin >> a[i].second;
  }
  vector<pair<bool, long long>> visited(n, {false, 0});
  visited[0].first = true;
  visited[0].second = 1;
  long long i = 0;
  while (1) {
    if (a[i].first == '>') {
      if (i + a[i].second >= n) {
        cout << "FINITE" << '\n';
        return 0;
      }
      visited[i + a[i].second].first = true;
      visited[i + a[i].second].second += 1;
      if (visited[i + a[i].second].second >= 2) {
        cout << "INFINITE" << '\n';
        return 0;
      }
      i += a[i].second;
    } else {
      if (i - a[i].second < 0) {
        cout << "FINITE" << '\n';
        return 0;
      }
      visited[i - a[i].second].first = true;
      visited[i - a[i].second].second += 1;
      if (visited[i - a[i].second].second >= 2) {
        cout << "INFINITE" << '\n';
        return 0;
      }
      i -= a[i].second;
    }
  }
  return 0;
}
