#include <bits/stdc++.h>
using namespace std;
char _buf[1024];
int _bytes_read_ = 1024 - 1;
char *_s = _buf + _bytes_read_;
inline char getc1() {
  if (_s >= _buf + _bytes_read_) {
    _bytes_read_ = fread(_buf, 1, 1024 - 1, stdin);
    _buf[_bytes_read_] = 0;
    _s = _buf;
  }
  return *(_s++);
}
inline int readint() {
  char t = getc1();
  int n = 1, res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = 10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline long long readLL() {
  char t = getc1();
  int n = 1;
  long long res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = (long long)10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline char skipwhitespace() {
  char ch = getc1();
  while (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') ch = getc1();
  return ch;
}
inline int readline(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n' && ch != 0)) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline int readstr(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n' && ch != ' ' && ch != '\t' && ch != 0)) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline string readstring(int n) {
  char buf[n + 1];
  readstr(buf);
  string s(buf);
  return s;
}
inline double readdouble() {
  char buf[40];
  readstr(buf);
  double d;
  sscanf(buf, "%lf", &d);
  return d;
}
inline long double readLD() {
  char buf[80];
  readstr(buf);
  long double d;
  sscanf(buf, "%Lf", &d);
  return d;
}
inline char readchar() { return skipwhitespace(); }
char outbuf[1024];
int outbuf_p;
inline void putc1(char ch) {
  if (outbuf_p >= 1024) {
    fwrite(outbuf, 1, 1024, stdout);
    outbuf_p = 0;
  }
  outbuf[outbuf_p++] = ch;
}
inline void flush() {
  fwrite(outbuf, 1, outbuf_p, stdout);
  outbuf_p = 0;
}
inline void writeint(int n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[10];
  int i = 9;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 10) putc1(buf[i]);
}
inline void writeLL(long long n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[25];
  int i = 24;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 25) putc1(buf[i]);
}
inline void writestr(char *s) {
  char *p = s;
  while (*p) {
    putc1(*p);
    p++;
  }
}
inline void writedouble(double d, int p) {
  char buf[40];
  sprintf(buf, "%.*f", p, d);
  writestr(buf);
}
double my_sqrt(double x, double delta = .00001) {
  double g = x / 2, ng;
  while (fabs(g - (ng = (x / g + g) / 2)) > delta) g = ng;
  return g;
}
template <class T>
void print(vector<T> v) {
  for (T i : v) cout << i << " ";
}
template <class T>
void fill(vector<T> v, T val = 0) {
  fill(v.begin(), v.end(), val);
}
vector<string> split(string S, string D) {
  vector<string> ar;
  int pos = 0, last = 0;
  while ((pos = S.find(D, last)) != string::npos) {
    string sub = S.substr(last, pos - last);
    if (sub.length() > 0) ar.push_back(sub);
    last = pos + D.length();
  }
  string sub = S.substr(last);
  if (sub.length() > 0) ar.push_back(sub);
  return ar;
}
inline long long pow(long long b, long long e) {
  long long ans = 1;
  while (e--) ans *= b;
  return ans;
}
inline long long pow(long long b, long long e, long long mod) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = ans * b % mod;
    b = b * b % mod;
    e >>= 1;
  }
  return ans;
}
template <class T>
T egcd(T a, T b, T &x, T &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  T x1, y1;
  T d = egcd(b % a, a, x1, y1);
  x = y1 - x1 * (b / a);
  y = x1;
  return d;
}
long long inv(long long a, long long m) {
  long long inv, y;
  assert(egcd(a, m, inv, y) == 1);
  if (inv < 0) inv += m;
  return inv;
}
inline long long gcd(long long a, long long b) {
  while (b) {
    long long t = b;
    b = a % b;
    a = t;
  }
  return a;
}
int dp[100001];
int main() {
  int n = readint();
  string s = readstring(n + 1);
  int len[n + 1];
  for (int a = 0; a < (n); a++) len[a] = readint();
  int i = 0;
  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  while (1) {
    if (s[i] == '>')
      i += len[i];
    else
      i -= len[i];
    if (i < 0 or i >= n) break;
    int &ret = dp[i];
    if (ret >= 0) {
      printf("INFINITE\n");
      return 0;
    }
    ret = i;
  }
  printf("FINITE\n");
  return 0;
}
