#include <bits/stdc++.h>
using namespace std;
template <typename T>
T mod(T a, T b) {
  return (a < b ? a : a % b);
}
long long t, i, n;
string s;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> n;
  cin >> s;
  long long arr[n];
  long long flag1[100000] = {0};
  int flag2 = 1;
  for (i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  long long curr = 0;
  while (flag2) {
    if (flag1[curr] == 1 && curr >= 0 && curr < n) {
      cout << "INFINITE" << endl;
      flag2 = 0;
      break;
    } else {
      flag1[curr] = 1;
      if (s[curr] == '<' && curr - arr[curr] < 0) {
        cout << "FINITE" << endl;
        flag2 = 0;
        break;
      } else if (s[curr] == '>' && curr + arr[curr] >= n) {
        cout << "FINITE" << endl;
        flag2 = 0;
        break;
      } else {
        if (s[curr] == '>')
          curr = arr[curr] + curr;
        else
          curr = curr - arr[curr];
      }
    }
  }
  return 0;
}
