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:All except: ASM32-GCC ASM64 MAWK GAWK BC C-CLANG CPP14-CLANG CPP14 COBOL COFFEE D-DMD D-CLANG DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PY_NBC R RACKET RUST CHICKEN SED SQLITE SWIFT UNLAMBDA VB.NET
Resource:High School Programming League

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