n,_,*a=list(map(int,open(0).read().split()))

a=set(a)

c,d=1,0

for i in range(n):n=(c+d)%(10**9+7)*(not-~i in a);c,d=n,c

print(n)
n,b,*a=list(map(int,open(0).read().split()))

a=set(a)

d=i=0

c=1

while i<n:i+=1;b=(c+d)%(10**9+7)*(not i in a);c,d=b,c

print(b)
n, _, *a = list(map(int, open(0).read().split()))
a = set(a)
c, d = 1, 0
for i in range(n):
    n = (c + d) % (10**9 + 7) * (not -~i in a)
    c, d = n, c
print(n)

n, b, *a = list(map(int, open(0).read().split()))
a = set(a)
d = i = 0
c = 1
while i < n:
    i += 1
    b = (c + d) % (10**9 + 7) * (not i in a)
    c, d = b, c
print(b)

-n, _, *a = list(map(int, open(0).read().split())) +n, b, *a = list(map(int, open(0).read().split())) -c, d = 1, 0 -for i in range(n): -    n = (c + d) % (10**9 + 7) * (not -~i in a) -    c, d = n, c -print(n) +d = i = 0 +c = 1 +while i < n: +    i += 1 +    b = (c + d) % (10**9 + 7) * (not i in a) +    c, d = b, c +print(b)