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

a = [0] * N

for _ in range(M):

    a[int(eval(input()))-1] = '!'



for i in range(N):

    if i == 0:

        if a[i] != '!':

            a[i] = 1

        else:

            a[i] = 0

    elif i == 1:

        if a[i] != '!':

            a[i] = a[i-1] + 1

        else:

            a[i] = 0

    else:

        if a[i] != '!':

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

        else:

            a[i] = 0



print((a[N-1] % 1000000007))

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

a = [0] * N

for _ in range(M):

    a[int(eval(input()))-1] = '!'



for i in range(N):

    if i == 0:

        if a[i] != '!':

            a[i] = 1

        else:

            a[i] = 0

    elif i == 1:

        if a[i] != '!':

            a[i] = a[i-1] + 1

        else:

            a[i] = 0

    else:

        if a[i] != '!':

            a[i] = (a[i-1] + a[i-2]) % 1000000007

        else:

            a[i] = 0



print((a[N-1] % 1000000007))

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

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

-            a[i] = a[i - 1] + a[i - 2] +            a[i] = (a[i - 1] + a[i - 2]) % 1000000007