#include <bits/stdc++.h>
using namespace std;
bool dp[100005];
int a[100005];
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int cur = 0;
  bool f = false;
  while (true) {
    if (cur >= n || cur < 0) {
      f = true;
      break;
    }
    if (dp[cur]) {
      break;
    }
    dp[cur] = true;
    if (s[cur] == '>') {
      cur += a[cur];
    } else if (s[cur] == '<') {
      cur -= a[cur];
    }
  }
  if (f) {
    cout << "FINITE";
  } else {
    cout << "INFINITE";
  }
  return 0;
}
