#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 123;
const int mod = 1e9 + 7;
const int INF = 1e9 + 1;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n;
char a[N];
int d[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> d[i];
  int id = 1, t = 0;
  int i = 1;
  while (i <= n) {
    if (a[i] == '>') {
      id += d[i];
    } else {
      id -= d[i];
    }
    i = id;
    if (id > n || id < 1) {
      cout << "FINITE";
      return 0;
    }
    t++;
    if (t > N + 323) {
      cout << "INFINITE ";
      return 0;
    }
  }
  return 0;
}
