#include <bits/stdc++.h>
using namespace std;
clock_t __START, __END;
double __TOTALTIME;
void _MS() { __START = clock(); }
void _ME() {
  __END = clock();
  __TOTALTIME = (double)(__END - __START) / CLOCKS_PER_SEC;
  cout << "Time: " << __TOTALTIME << " s" << endl;
}
const double E = 2.718281828;
const double PI = acos(-1.0);
const long long INF = (1LL << 60);
const int inf = (1 << 30);
const double ESP = 1e-9;
const int mod = (int)1e9 + 7;
const int N = (int)1e6 + 10;
char s[N];
int a[N];
bool vis[N];
signed main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  int pos = 1;
  bool ok = 0;
  while (!vis[pos]) {
    vis[pos] = 1;
    if (s[pos] == '<')
      pos -= a[pos];
    else
      pos += a[pos];
    if (pos < 1 || pos > n) {
      ok = 1;
      break;
    }
  }
  if (ok)
    printf("FINITE\n");
  else
    printf("INFINITE\n");
  return 0;
}
