#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> v(n + 1, 0);
  vector<char> dr(n + 1, 0);
  vector<bool> used(n + 1, 0);
  for (int i = 1; i <= n; ++i) cin >> dr[i];
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
    if (dr[i] == '<') v[i] *= -1;
  }
  int cur = 1;
  while (cur >= 1 && cur <= n && !used[cur]) {
    used[cur] = 1;
    cur += v[cur];
  }
  if (cur >= 1 && cur <= n)
    cout << "INFINITE";
  else
    cout << "FINITE";
  return 0;
}
