#include <bits/stdc++.h>
using namespace std;
vector<int> v;
map<long long, long long> cntb, cnta, cntc;
long long emerlads(long long sticks, long long diamond) {
  if (sticks <= 0 || diamond <= 0 || (sticks == 1 && diamond == 1))
    return 0;
  else
    return max(1 + emerlads(sticks - 1, diamond - 2),
               1 + emerlads(sticks - 2, diamond - 1));
}
int binaryToDecimal(int n) {
  int num = n;
  int dec_value = 0;
  int base = 1;
  int temp = num;
  while (temp) {
    int last_digit = temp % 10;
    temp = temp / 10;
    dec_value += last_digit * base;
    base = base * 2;
  }
  return dec_value;
}
const int N = 100010;
int a[N], b[N], c[N], d[N];
bool comp(pair<char, int> lhs, pair<char, int> rhs) {
  if (lhs.first == rhs.first) return lhs.second < rhs.second;
  return lhs.first > rhs.first;
}
long long fastpow(long long a, long long b) {
  if (!b) return 1;
  long long sq = fastpow(a, b / 2);
  sq *= sq;
  if (b % 2 != 0) sq *= a;
  return sq;
}
map<long long, long long> vis;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  long long d[n];
  for (int i = 0; i < n; i++) cin >> d[i];
  long long cnt = 0, cnt1 = 0;
  if (n == 1) {
    cout << "FINITE\n";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    cnt1++;
    if (s[i] == '>') {
      cnt += d[i];
      if (d[i] > 1) i += d[i] - 1;
    } else if (s[i] == '<') {
      cnt -= d[i];
      i -= (d[i] + 1);
    }
    if (cnt > n || cnt < 0 || (cnt > 0 && i == n - 1)) {
      cout << "FINITE\n";
      break;
    }
    if (cnt1 > 4 * n) {
      cout << "INFINITE\n";
      break;
    }
  }
  return 0;
}
