#include <bits/stdc++.h>
using namespace std;
long long a[100010];
int vis[100010];
string s;
int main(void) {
  int n;
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; ++i) cin >> a[i];
  memset(vis, 0, sizeof(vis));
  long long st = 0;
  bool loop = false;
  while (true) {
    if (st < 0 || st >= n) {
      loop = false;
      break;
    }
    if (vis[st]) {
      loop = true;
      break;
    }
    vis[st] = true;
    if (s[st] == '>')
      st += a[st];
    else
      st -= a[st];
  }
  if (loop)
    cout << "INFINITE";
  else
    cout << "FINITE";
  return 0;
}
