#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
const int MOD = 1000 * 1000 * 1000 + 7;
void solve();
int main() {
  auto start = clock();
  cout.sync_with_stdio(0);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  int t = 1;
  while (t--) {
    solve();
  }
  cerr << "\nTime: " << (clock() - start) / 1.0 / CLOCKS_PER_SEC << "\n";
  return 0;
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> d(n);
  for (int i = 0; i < n; ++i) {
    cin >> d[i];
  }
  int cur = 0;
  vector<char> visited(n, false);
  while (cur >= 0 && cur < n && !visited[cur]) {
    visited[cur] = true;
    int sign = (s[cur] == '>') ? 1 : -1;
    cur += sign * d[cur];
  }
  if (cur < 0 || cur >= n) {
    cout << "FINITE" << endl;
  } else {
    cout << "INFINITE" << endl;
  }
}
