n,m=list(map(int,input().split()))

stair_m=[True]*(110000)

for i in range(m):

    a=int(eval(input()))

    stair_m[a]=False

dp=[0]*(110000)

dp[0]=1

for i in range(1,n+1):

    if stair_m[i]:

        dp[i]=dp[i-1]+dp[i-2]

    else:

        dp[i]=0

print((dp[n]%1000000007))
n,m=list(map(int,input().split()))

stair=[False]*(n+1)

for i in range(m):

    a=int(eval(input()))

    stair[a]=True





dp=[0]*(n+1)

dp[0]=1



for i in range(1,n+1):

    if stair[i]:

        dp[i]=0

    else:

        dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)

print((dp[n]))
n, m = list(map(int, input().split()))
stair_m = [True] * (110000)
for i in range(m):
    a = int(eval(input()))
    stair_m[a] = False
dp = [0] * (110000)
dp[0] = 1
for i in range(1, n + 1):
    if stair_m[i]:
        dp[i] = dp[i - 1] + dp[i - 2]
    else:
        dp[i] = 0
print((dp[n] % 1000000007))

n, m = list(map(int, input().split()))
stair = [False] * (n + 1)
for i in range(m):
    a = int(eval(input()))
    stair[a] = True
dp = [0] * (n + 1)
dp[0] = 1
for i in range(1, n + 1):
    if stair[i]:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7)
print((dp[n]))

-stair_m = [True] * (110000) +stair = [False] * (n + 1) -    stair_m[a] = False -dp = [0] * (110000) +    stair[a] = True +dp = [0] * (n + 1) -    if stair_m[i]: -        dp[i] = dp[i - 1] + dp[i - 2] +    if stair[i]: +        dp[i] = 0 -        dp[i] = 0 -print((dp[n] % 1000000007)) +        dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7) +print((dp[n]))