Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

HS11LFSR - Linear Feedback Shift Register

Given a Fibonacci linear feedback shift register (LFSR) please emulate its behaviour.

Input

First t<100, the number of test cases. In each of the following t lines:
1<l<=1024 - the length of the register (the number of bits),
seed - the initial value of the LFSR in binary format,
0<p<l - the number of taps (bits which influence the input),
p1,p2,...,pp - the taps in increasing order in decimal format, 0<pi<=l.

Output

Please output, byte by byte, the first 128 output bits of the register in hexadecimal format.

Example

Input:
2
3 010 2 2 3
5 00110 3 1 3 5

Output:
A7 D3 E9 74 3A 9D 4E A7 D3 E9 74 3A 9D 4E A7 D3
85 9B C2 4D E1 A6 70 53 B8 29 DC 14 6E 0A 37 85 

Scoring

By solving this problem you score 10 points.


Added by:kuszi
Date:2012-01-19
Time limit:0.306s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ADA95 ASM32 GAWK BASH BF C CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO HASK ICON ICK JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYTHON3 RUBY SCALA SCM guile SCM qobi SED ST TCL WHITESPACE
Resource:High School Programming League

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.