#include <bits/stdc++.h>
using namespace std;
int abso(int a, int b) {
  if (a < b)
    return b - a;
  else
    return a - b;
}
long long power(long long x, long long e) {
  long long temp;
  if (e == 0) return 1;
  if (e % 2 == 0) {
    temp = power(x, e / 2);
    return temp * temp;
  } else {
    temp = power(x, e / 2);
    return temp * temp * x;
  }
}
bool cmp(pair<pair<int, int>, int> x, pair<pair<int, int>, int> y) {
  if (x.first.first == y.first.first) {
    if (x.first.second == y.first.second)
      return x.second < y.second;
    else
      return x.first.second > y.first.second;
  }
  return x.first.first > y.first.first;
}
bool cmp1(pair<int, int> x, pair<int, int> y) {
  if (x.second == y.second) return x.first < y.first;
  return x.second < y.second;
}
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  int arr[n + 1];
  for (int i = 1; i <= n; i++) cin >> arr[i];
  int cur = 1;
  int visit[n + 1];
  memset(visit, 0, sizeof visit);
  int flag = 0, next;
  visit[cur] = 1;
  while (1) {
    if (str[cur - 1] == '<') {
      next = cur - arr[cur];
      if (next < 1) {
        flag = 1;
        break;
      } else {
        if (visit[next] == 1) {
          flag = 2;
          break;
        } else {
          visit[next] = 1;
          cur = next;
        }
      }
    } else {
      next = cur + arr[cur];
      if (next > n) {
        flag = 1;
        break;
      } else {
        if (visit[next] == 1) {
          flag = 2;
          break;
        } else {
          visit[next] = 1;
          cur = next;
        }
      }
    }
  }
  if (flag == 1)
    cout << "FINITE" << endl;
  else
    cout << "INFINITE" << endl;
  return 0;
}
