#include <bits/stdc++.h>
const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long long MXLL = 9223372036854775807;
const int Sz = 1110111;
using namespace std;
inline void Read_rap() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
}
int n;
char dir[Sz];
int d[Sz];
bool used[Sz];
void dfs(int pos) {
  if (pos > n || pos < 1) {
    cout << "FINITE";
    exit(0);
  }
  if (used[pos]) {
    cout << "INFINITE";
    exit(0);
  }
  used[pos] = 1;
  dfs(pos + (dir[pos] == '>' ? +1 : -1) * d[pos]);
}
int main() {
  Read_rap();
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> dir[i];
  for (int i = 1; i <= n; i++) cin >> d[i];
  dfs(1);
  return 0;
}
