#include <bits/stdc++.h>
using namespace std;
class GenUtils {
 public:
  GenUtils() {}
  static vector<long long int> fillVector() {
    int n;
    cin >> n;
    vector<long long int> A;
    long long int data;
    for (int i = 0; i < n; i++) {
      cin >> data;
      A.push_back(data);
    }
    return A;
  }
  static void printVector(vector<long long int> &A) {
    for (int i = 0; i < A.size(); i++) {
      cout << A[i] << " ";
    }
    cout << '\n';
    return;
  }
  static bool compVectors(vector<int> &left, vector<int> &right) {
    int s1 = 0;
    int s2 = 0;
    while (s1 < left.size() && s2 < right.size()) {
      if (left[s1] < right[s2]) {
        return true;
      } else if (left[s1] > right[s2]) {
        return false;
      }
      s1++;
      s2++;
    }
    if (s1 != left.size()) {
      return false;
    }
    return true;
  }
  static void coutWithPrecision(double n, int precision, bool nextLine) {
    int data = (int)n;
    int len = 0;
    if (data == 0) {
      len = 1;
    } else {
      while (data != 0) {
        data = data / 10;
        len++;
      }
    }
    std::cout << std::setprecision(len + precision) << n;
    if (nextLine) {
      cout << '\n';
    }
  }
  static vector<bool> getSeive(int n) {
    vector<bool> seive(n + 1);
    for (int i = 0; i <= n; i++) seive[i] = true;
    for (int i = 2; i * i <= n; i++) {
      if (seive[i] == true) {
        for (int j = i * i; j <= n; j += i) {
          seive[j] = false;
        }
      }
    }
    return seive;
  }
  static int BS(vector<int> &arr, int data, int s, int e) {
    if (s > e) {
      return -1;
    }
    int mid = s + (e - s) / 2;
    if (arr[mid] == data) {
      return mid;
    } else if (arr[mid] < data) {
      return BS(arr, data, mid + 1, e);
    } else {
      int ans1 = BS(arr, data, s, mid - 1);
      ans1 = (ans1 == -1) ? mid : ans1;
      return ans1;
    }
  }
  static int BS(vector<int> &arr, int data) {
    return GenUtils::BS(arr, data, 0, 0);
  }
};
unsigned long long int toInteger(string str) {
  unsigned long long int ans = 0;
  unsigned long long int pow = 1;
  for (int i = str.size() - 1; i >= 0; i--) {
    ans += (str[i] - '0') * pow;
    pow = pow * 10;
  }
  return ans;
}
bool inRange(int r, int c, int lowR, int highR, int lowC, int highC, int rAdd,
             int cAdd) {
  if (r + rAdd >= lowR && r + rAdd <= highR && c + cAdd >= lowC &&
      c + cAdd <= highC)
    return true;
  return false;
}
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  vector<long long int> arr;
  vector<bool> visited;
  for (int i = 0; i < n; i++) {
    long long int data;
    cin >> data;
    arr.push_back(data);
    visited.push_back(false);
  }
  for (int i = 0; i < n;) {
    if (visited[i]) {
      cout << "INFINITE" << '\n';
      return 0;
    }
    visited[i] = true;
    if (str[i] == '>' && i + arr[i] > arr.size() - 1) {
      cout << "FINITE" << '\n';
      return 0;
    } else if (str[i] == '<' && i - arr[i] < 0) {
      cout << "FINITE" << '\n';
      return 0;
    } else if (str[i] == '>' && i + arr[i] <= arr.size() - 1) {
      i = i + arr[i];
    } else if (str[i] == '<' && i - arr[i] >= 0) {
      i = i - arr[i];
    }
  }
  return 0;
}
