Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.

The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper starts in the first cell and follows the instructions written on the cells. Grasshopper stops immediately if it jumps out of the strip. Now Artem wants to find out if this will ever happen.


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — length of the strip. 

Next line contains a string of length n which consists of characters "<" and ">" only, that provide the direction of the jump from the corresponding cell. Next line contains n integers d_{i} (1 ≤ d_{i} ≤ 10^9) — the length of the jump from the i-th cell.


-----Output-----

Print "INFINITE" (without quotes) if grasshopper will continue his jumps forever. Otherwise print "FINITE" (without quotes).


-----Examples-----
Input
2
><
1 2

Output
FINITE

Input
3
>><
2 1 1

Output
INFINITE


-----Note-----

In the first sample grasshopper starts from the first cell and jumps to the right on the next cell. When he is in the second cell he needs to jump two cells left so he will jump out of the strip.

Second sample grasshopper path is 1 - 3 - 2 - 3 - 2 - 3 and so on. The path is infinite.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
s = list([1 if x == '>' else -1 for x in input().strip()])
d = list(map(int, input().strip().split()))
b = [False for _ in range(n)]

c = 0
while True:
    c += s[c] * d[c]
    if c >= n or c < 0:
        print('FINITE')
        return
    if b[c]:
        print('INFINITE')
        return
    b[c] = True




n = int(input())
s = input()
l = list(map(int, input().split()))
count = 0
mas = [False for i in range(n)]
pos = 0
ans = 'INFINITE'
for i in range(n):
    if mas[pos]:
        break
    else:
        mas[pos] = True
    if s[pos] == '<':
        if pos - l[pos] < 0:
            ans =  'FINITE'
        else:
            pos -= l[pos]
    else:
        if pos + l[pos] >= n:
            ans = 'FINITE'
        else:
            pos += l[pos]
print(ans)

n = int(input())
str = input()
inp = list(map(int, input().split()))

for i in range(len(str)):
    if str[i] == '<':
        inp[i] *= -1

visited = [0 for i in range(n)]

cur = 0

while cur >= 0 and cur < n and visited[cur] != 1:
    visited[cur] = 1
    cur += inp[cur]

if cur >= 0 and cur < n:
    print("INFINITE")
else:
    print("FINITE")

n = int(input())
s = input()
num = list(map(int, input().split()))
pos = 0
b = [True] * n
while n > pos >= 0 and b[pos]:
    b[pos] = False
    if s[pos] == ">":
        pos += num[pos]
    else:
        pos -= num[pos]
if n > pos >= 0:
    print("INFINITE")
else:
    print("FINITE")

n = int(input())
instructions = list(zip(input(), [int(i) for i in input().split()]))

used = set()
pos = 0
while True:
    if pos < 0 or pos >= n:
        print('FINITE')
        break
    if pos in used:
        print('INFINITE')
        break
    used.add(pos)

    direct, length = instructions[pos]
    if direct == '>':
        pos += length
    else:
        pos -= length


n = int(input())
cells = input()
lengths = list(map(int, input().split()))
visited = set()
i = 0
while (i not in visited) and (i < n) and (i > -1):
	visited.add(i)
	if cells[i] == '>':
		i += lengths[i]
	else:
		i -= lengths[i]
	#print('new', i)
	
if (i < n) and (i >= 0):
	print("INFINITE")
else:
	print("FINITE")
	


class graph():
    def __init__(self,n,v):
        self.G=dict()
        for i in range(1,n+1):
            self.G.update([(i,set())])
        self.v=v
        self.length=n
    def AppendEdge(self,a):
        self.G[a[0]].add(a[1])
        if not self.v:
            self.G[a[1]].add(a[0])
    def ShowAdjacent(self,a):
        return self.G[a]
    def ShowLength(self):
        return self.length
    def Show(self):
        print(self.G)

n=int(input())
s=input()
f=[int(z) for z in input().split()]
##G=graph(n+2,1)
Vis=[0]*n
k=1
i=0
Vis[0]=1
while k!=0:
	if s[i]=='>':
		t=i+f[i]
		if t>=n:
			print('FINITE')
			k=0
		elif Vis[t]:
			print('INFINITE')
			k=0
		else:
			Vis[t]=1
			i=t
	else:
		t=i-f[i]
		if t<0:
			print('FINITE')
			k=0
		elif Vis[t]:
			print('INFINITE')
			k=0
		else:
			Vis[t]=1
			i=t

import sys
def dfs(v):
    used[v] = True
    for i in ed[v]:
        if not used[i]:
            dfs(i)



sys.setrecursionlimit(1000000)
n = int(input())
data1 = input()
data2 = list(map(int, input().split()))
used = [False for i in range(n)]
data3 = [None for i in range(n)]
for i in range(n):
    if data1[i] == ">":
        data3[i] = i + data2[i]
    else:
        data3[i] = i - data2[i]
ans = True
index = 0
prev = -1
for i in range(2 * n):
    used[index] = True
    prev = index
    if data3[index] >= n or data3[index] < 0:
        ans = False
        break
    else:
        index = data3[index]
        if index == prev:
            break
if ans:
    print("INFINITE")
else:
    print("FINITE")

from sys import stdin as Si
from math import floor as F 
from collections import defaultdict as dt
from operator import itemgetter as ig

def __starting_point():

    n = int(Si.readline())
    d = Si.readline().strip('\n')
    c = tuple(map(int,Si.readline().split()))
    tub,i,Exit = set([0]),0,False
    while not Exit:
        if d[i]=='>':   i=i+c[i]
        else:   i=i-c[i]
        if  i<0 or i>=n:   print('FINITE');break
        elif i in tub:    print('INFINITE');break
        else: tub.add(i)
        
        
    
    
'''
A. Little Artem and Grasshopper
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.

The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper starts in the first cell and follows the instructions written on the cells. Grasshopper stops immediately if it jumps out of the strip. Now Artem wants to find out if this will ever happen.
Input

The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — length of the strip.

Next line contains a string of length n which consists of characters "<" and ">" only, that provide the direction of the jump from the corresponding cell. Next line contains n integers di (1 ≤ di ≤ 109) — the length of the jump from the i-th cell.
Output

Print "INFINITE" (without quotes) if grasshopper will continue his jumps forever. Otherwise print "FINITE" (without quotes).
Examples
Input

2
><
1 2

Output

FINITE

Input

3
>><
2 1 1

Output

INFINITE

Note

In the first sample grasshopper starts from the first cell and jumps to the right on the next cell. When he is in the second cell he needs to jump two cells left so he will jump out of the strip.

Second sample grasshopper path is 1 - 3 - 2 - 3 - 2 - 3 and so on. The path is infinite.
'''

__starting_point()

line_length = int(input())
directions = input()
distances = [int(distance) for distance in input().split()]
visited_cells = set()
current_cell = 0
while 0 <= current_cell < line_length:
    if current_cell in visited_cells:
        break
    else:
        visited_cells.add(current_cell)
        if directions[current_cell] == '>':
            current_cell += distances[current_cell]
        else:
            current_cell -= distances[current_cell]
if 0 <= current_cell < line_length:
    print("INFINITE")
else:
    print("FINITE")


def __starting_point():
    n = int(input())
    d = input()
    w = [int(i) for i in input().split()]
    visited = set()
    i = 0
    while (i not in visited) and (i < n) and (i > -1):
        visited.add(i)
        if d[i] == '>':
            i += w[i]
        else:
            i -= w[i]
    if (i >= 0) and (i < n):
        print('INFINITE')
    else:
        print('FINITE')
__starting_point()

n, s = int(input()), input()
a = [int(i) for i in input().split()]
c = i = 0
while True:
    if s[i] == '>':
        i += a[i]
    else:
        i -= a[i]
    if i < 0 or i >= n:
        print("FINITE")
        return
    c += 1
    if c > n:
        print("INFINITE")
        return

n = int(input())
s = input()
a = list(map(int, input().split()))
WAS = False
pos = 1
for i in range(0, n) :
    if s[pos - 1] == '<' : pos -= a[pos - 1]
    else : pos += a[pos - 1]
    if pos < 1 or pos > n : WAS = True
    if WAS : break
if WAS : print("FINITE")
else : print("INFINITE")



n = int(input())
s = input(); a = len(s)
j = list(map(int, input().split()))
x = 1
b = 'INFINITE'
tmp = 0
while tmp < n:
	if s[x-1] == '>':
		x += j[x-1]
		if x > n:
			b = 'FINITE'; break
	elif s[x-1] == '<':
		x -= j[x-1]
		if x <= 0:
			b = 'FINITE'; break
	tmp += 1
print(b)

def main():
	n = int(input())
	arrows = input()
	cells = [int(x) for x in input().split()]
	print(solver(arrows, cells))

def solver(arrows, cells):
	for i in range(len(arrows)):
		if arrows[i] == '<':
			cells[i] = - cells[i]
	visited = [False] * len(cells)
	index = 0
	while True:
		if index >= len(cells) or index < 0:
			return "FINITE"
		elif visited[index] == True:
			return "INFINITE"
		else:
			visited[index] = True
			index = index + cells[index]

#print(solver(">><", [2, 1, 1]))
#print(solver("><", [1, 2]))
main()

def main():
    n = int(input())
    l = [j - i if c == "<" else j + i for c, i, j in zip(input(), list(map(int, input().split())), list(range(n)))]
    v, i = [True] * n, 0
    while 0 <= i < n:
        if v[i]:
            v[i] = False
        else:
            print("INFINITE")
            return
        i = l[i]
    print("FINITE")


def __starting_point():
    main()

__starting_point()

n = int(input())
s = list(1 if x == '>' else -1 for x in input())
l = list(map(int, input().split()))
summ = 1
cur = 0
next = 0
for i in range(n):
    if cur < 0 or cur > n - 1:
        print('FINITE')
        return
    if l[cur] == 0:
        print('INFINITE')
        return
    next += l[cur] * s[cur]
    l[cur] = 0
    cur = next
print('INFINITE' if 0 <= cur < n else 'FINITE')

n=int(input())
S=input()
l=list(map(int,input().split()))
i=0
c=1
while i>=0 or i>=n-1 :
    if S[i]=='>' and i+l[i]>n-1 :
        c=1
        break
    if S[i]=='<' and i-l[i]<0 :
        c=1
        break
    if l[i]==0 :
        c=0
        break
    d=l[i]
    l[i]=0
    if S[i]=='>' :
        i=i+d
    else :
        i=i-d
if c==1 :
    print('FINITE')
else :
    print('INFINITE')


def __starting_point():
    n = int(input())
    ins = list(str(input()))
    abi = list(map(int, input().split()))
    sta = [False] * n
    pos = 0
    while True:
        sta[pos] = True
        if ins[pos] == '>':
            pos += abi[pos]
        elif ins[pos] == '<':
            pos -= abi[pos]
        if pos < 0 or pos > n - 1:
            print('FINITE')
            break
        elif sta[pos]:
            print('INFINITE')
            break

__starting_point()

n = int(input())
s = input()
numbers = list(map(int, input().split()))
a = 0
cells = []
condition = False
while True:
    if a < 0 or a >= n:
        print("FINITE")
        break
    if s[a] == ">":
        a += numbers[a]
    else:
        condition = True
        a -= numbers[a]
    if condition and a in cells:
        print("INFINITE")
        break
    cells.append(a)

n=int(input())

a=input()  #string input
count=0
flag=0



b=[int(r) for r in input().split()]

#b=input().split()

i=int()
for i in range(0,n,1):
     if i==0:
         if a[i]=='>':
          count=count+b[i]
         else:
           count=count-b[i]

     elif a[count]=='>':
        count+=b[count]
     else:
        count-=b[count];

     if count>=n or count<0:
        flag=1
        break

if flag==1:
  print("FINITE")
else:
  print("INFINITE")



n,s,i=int(input()),input(),0
d=list(map(int,input().split()))
for _ in range(len(s)+1):
  if i<0 or i>=len(s):print('FINITE');return
  i+=[d[i],-d[i]][s[i]=='<']
print('INFINITE')


n,s,i=int(input()),input(),0

d=list(map(int,input().split()))

for _ in range(len(s)+1):

  if i<0 or i>=len(s):print('FINITE');return

  i+=[d[i],-d[i]][s[i]=='<']

print('INFINITE')



# Made By Mostafa_Khaled

def main():
    n = int(input())
    d = input()
    l = [int(c) for c in input().split()]
    visited = {0}
    i = 0
    while 0 <= i < n:
        di, li = d[i], l[i]
        i = i + li if di == '>' else i - li
        if i in visited:
            print('INFINITE')
            return
        visited.add(i)

    print('FINITE')
        

def __starting_point():
    main()

__starting_point()

n=int(input())
s=input()
l=list(map(int,input().split()))
L=[0 for i in range(n)]
i=0
while (True):
    if L[i]==-1 :
        print("INFINITE")
        return
    L[i]=-1
    if s[i]==">" :
        i+=l[i]
    else :
        i-=l[i]
    if i<=-1 or i>=n :
        print("FINITE")
        return