Let's suppose that we have fixed a permutation p with length n. We say that a string t is a p-drome if it has the length n, and for all the characters of this string, it is true that t_i=t_p_i.
You have a string s and a permutation p. For each substring of s of length n, you have to find out if it is a p-drome or not.
On the first line, you are given three integers n, m, and c: the length of the permutation, the length of the string and the size of the alphabet of the string (1≤n≤m≤500,000; 1≤c≤500,000).
On the second line, you are given n integers p_i: the permutation itsekf (1≤p_i≤n; p_i=p_j if i=j).
On the third line, you are given m integers s_i: the initial string (1≤s_i≤c).
Print m−n+1 characters without spaces: i-th character must be "1" if substring s_i…s_i+n−1 is a p-drome, and "0" otherwise.