#include <bits/stdc++.h>
using namespace std;
int flag[100001];
long long int b[100001];
int main() {
  long long int n;
  cin >> n;
  string a;
  cin >> a;
  for (long long int i = 0; i < n; i++) {
    cin >> b[i];
  }
  long long int ans = 0;
  long long int i = 0;
  while (1) {
    if (flag[i] == 0)
      flag[i] = 1;
    else {
      ans = 1;
      break;
    }
    long long int jumpval = b[i];
    if (a[i] == '<') {
      if (jumpval > i) {
        ans = 0;
        break;
      } else
        i = i - jumpval;
    } else if (a[i] == '>') {
      if (jumpval >= n - i) {
        ans = 0;
        break;
      } else
        i = i + jumpval;
    }
  }
  if (ans == 0)
    cout << "FINITE";
  else
    cout << "INFINITE";
  return 0;
}
