#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int MAXN = -1;
const int MOD = 1;
int main() {
  int n;
  while (cin >> n) {
    string s;
    cin >> s;
    vector<int> d(n);
    for (int i = 0; i < n; i++) cin >> d[i];
    int cur = 0;
    vector<int> used(n, 0);
    while (1) {
      if (cur < 0 || cur >= n) {
        cout << "FINITE" << endl;
        break;
      }
      if (used[cur]) {
        cout << "INFINITE" << endl;
        break;
      }
      used[cur] = 1;
      if (s[cur] == '>')
        cur += d[cur];
      else
        cur -= d[cur];
    }
  }
  return 0;
}
