#include <bits/stdc++.h>
using namespace std;
string s;
int n;
vector<int> g[100005];
bool vis[100005] = {false};
int findjump(int t) {
  if (t < 0 || t >= n) return n;
  return t;
}
void dfs(int x) {
  if (vis[x]) return;
  vis[x] = true;
  for (int y : g[x]) dfs(y);
}
int main() {
  scanf("%d", &n);
  cin >> s;
  for (int i = 0; i <= n; ++i) g[i].clear();
  for (int i = 0; i <= n; ++i) {
    int len;
    scanf("%d", &len);
    if (s[i] == '>') {
      g[i].push_back(findjump(i + len));
    } else {
      g[i].push_back(findjump(i - len));
    }
  }
  dfs(0);
  if (!vis[n]) {
    cout << "INFINITE" << endl;
    return 0;
  }
  printf("%s", "FINITE");
}
