#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 6;
int visited[maxn], arr[maxn];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  string str = "";
  cin >> str;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  int count = 0;
  bool check = true;
  int current = 0;
  while (1) {
    if (visited[current]) {
      check = false;
      break;
    }
    visited[current] = 1;
    if (str[current] == '>')
      current += arr[current];
    else
      current -= arr[current];
    if (current >= n || current < 0) {
      check = true;
      break;
    }
  }
  if (check)
    cout << "FINITE" << '\n';
  else
    cout << "INFINITE" << '\n';
  return 0;
}
