#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const long long MAXN = 100005;
const long long INF = (long long)(1e9 + 100);
string failMessage;
void fail() {
  cout << failMessage;
  exit(0);
}
void solve() {
  long long n, i = 0;
  string s;
  cin >> n;
  vector<long long> a(n);
  cin >> s;
  for (long long i = 0; i < n; i++) cin >> a[i];
  vector<bool> vis(n, false);
  failMessage = "INFINITE";
  long long d;
  while (true) {
    if (i < 0 || i >= n) break;
    if (vis[i]) fail();
    vis[i] = true;
    d = a[i];
    if (s[i] == '<') d = -d;
    i += d;
  }
  cout << "FINITE";
}
int main() {
  const string FILENAME = "digits";
  ios_base::sync_with_stdio(0);
  solve();
}
