VK Cup 2016 - Round 2
A
Little Artem and Grasshopper
Codeforces
1000
原题
←B →
翻译中…

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).

翻译中…

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.

翻译中…

样例

Input #1
2
><
1 2
Output #1
FINITE
InputCopy OutputCopy
Input #2
3
>><
2 1 1
Output #2
INFINITE
InputCopy OutputCopy
题目信息
题号
641A
时间限制
2 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。