N, M = list(map(int, input().split()))

dp = [0] * N

for _ in range(M):

    a = int(eval(input()))

    dp[a-1] = -1



k = 1000000007





for i in range(N):

    if dp[i] == -1:

        dp[i] = 0

        continue

    if i == 0:

        dp[i] = 1

        continue

    if i == 1:

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

        continue



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



n = dp[-1] % k



print(n)

N, M = list(map(int, input().split()))

dp = [0] * N

for _ in range(M):

    a = int(eval(input()))

    dp[a-1] = -1



k = 1000000007





for i in range(N):

    if dp[i] == -1:

        dp[i] = 0

        continue

    if i == 0:

        dp[i] = 1

        continue

    if i == 1:

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

        continue



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

    dp[i] %= k







print((dp[-1]))

N, M = list(map(int, input().split()))
dp = [0] * N
for _ in range(M):
    a = int(eval(input()))
    dp[a - 1] = -1
k = 1000000007
for i in range(N):
    if dp[i] == -1:
        dp[i] = 0
        continue
    if i == 0:
        dp[i] = 1
        continue
    if i == 1:
        dp[i] = dp[i - 1] + 1
        continue
    dp[i] = dp[i - 1] + dp[i - 2]
n = dp[-1] % k
print(n)

N, M = list(map(int, input().split()))
dp = [0] * N
for _ in range(M):
    a = int(eval(input()))
    dp[a - 1] = -1
k = 1000000007
for i in range(N):
    if dp[i] == -1:
        dp[i] = 0
        continue
    if i == 0:
        dp[i] = 1
        continue
    if i == 1:
        dp[i] = dp[i - 1] + 1
        continue
    dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= k
print((dp[-1]))

-n = dp[-1] % k -print(n) +    dp[i] %= k +print((dp[-1]))