Monad
Easy
Execution time limit is 2 seconds
Runtime memory usage limit is 64 megabytes
Monad - the simplest mathematical object, which you can think of. Suppose there is a finite set M. And let there be a map of a finite set into itself. Each point of the finite set of maps to another point in this set. This is a monad.
Consider the monad f: X → X, где X = {1, ..., n}. We introduce the notation: f_k(x) = f(f(...f(x)...)) (k раз). Your task - for a given x and k define f_k(x).
Input
The first line contains the number n - the power of X (1 ≤ n ≤ 100000). The second line lists the space of integers n, i-th number is equal to f(i) (1 ≤ f(i) ≤ n). The third line contains the x (1 ≤ x ≤ n) and k (1 ≤ k ≤ 10^100000).
Output
In a single line output f_k(x).
Examples
Input #1
Answer #1
Submissions 111
Acceptance rate 10%