#include <bits/stdc++.h>
using namespace std;
const int maxLog = 10;
const int maxN = 1 << maxLog;
const int INF = 0x3c3c3c3c;
int f[333];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> a(n);
  f['>'] = 1;
  f['<'] = -1;
  for (auto &x : a) {
    cin >> x;
  }
  int v = 0;
  for (int i = 0; i < n * 2 + 2; i++) {
    int j = f[s[v]] * a[v];
    v += j;
    if (!(0 <= v && v < n)) {
      cout << "FINITE" << endl;
      return 0;
    }
  }
  cout << "INFINITE" << endl;
  return 0;
}
