#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int arr[100005], pos;
bool flag[100005];
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int ans = 1;
  while (true) {
    flag[pos] = 1;
    if (s[pos] == '>')
      pos += arr[pos];
    else
      pos -= arr[pos];
    if (pos < 0 || pos >= n) break;
    if (flag[pos]) {
      ans = 0;
      break;
    }
  }
  if (ans)
    cout << "FINITE" << endl;
  else
    cout << "INFINITE" << endl;
  return 0;
}
