#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const double PI = 2 * acos(0.0);
const int NPOS = -1;
const int MAX = 100001;
string s;
bitset<MAX> vis;
int n, x[MAX], c;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> s;
  for (int i = int(0); i < int(n); ++i) cin >> x[i];
  while (true) {
    if (c < 0 || c >= n) {
      cout << "FINITE" << '\n';
      break;
    }
    if (vis.test(c)) {
      cout << "INFINITE" << '\n';
      break;
    }
    vis.set(c);
    if (s[c] == '>')
      c += x[c];
    else
      c -= x[c];
  }
  return 0;
}
