#include <bits/stdc++.h>
using namespace std;
vector<int> vis;
int main() {
  int n, m;
  cin >> n;
  string x;
  cin >> x;
  int arr[n];
  int b = 1;
  for (int i = 0; i < n; i++) {
    if (x[i] == '>') {
      b = 1;
    } else
      b = -1;
    cin >> arr[i];
    arr[i] *= b;
    vis.push_back(0);
  }
  int ans = 0;
  vis[0] = 1;
  for (int i = 0; i < n; i++) {
    ans += arr[ans];
    if (ans >= n || ans < 0) break;
    if (vis[ans] == 1) {
      cout << "INFINITE";
      return 0;
    }
    vis[ans] = 1;
  }
  cout << "FINITE";
}
