#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, r, l, m, a, b, n, p, q, np, nl;
  int flag;
  string s;
  while (cin >> n) {
    char ara[n + 10];
    int ara1[n + 10];
    int visited[n];
    memset(visited, 0, sizeof(visited));
    for (i = 0; i < n; i++) cin >> ara[i];
    for (i = 0; i < n; i++) cin >> ara1[i];
    bool flag = 0;
    i = 0;
    p = 0;
    visited[0] = 1;
    while (i < n && i > -1) {
      if (ara[i] == '>') {
        i += ara1[i];
      } else {
        i -= ara1[i];
      }
      if (i < n && i > -1) {
        if (!visited[i]) {
          visited[i] = 1;
        } else {
          flag = 1;
          break;
        }
      }
    }
    if (flag)
      printf("INFINITE\n");
    else
      printf("FINITE\n");
  }
  return 0;
}
