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

a = []

stair = [1 for i in range(N+1)]

for i in range(M):

    stair[int(eval(input()))] = 0



dp = [0 for i in range(N+2)]



dp[1] = 1



MOD = 1000000007



for i in range(2, N+2):

    if stair[i-1] == 1:

        dp[i] = (dp[i-1] + dp[i-2]) % MOD



print((dp[N+1]))

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

a = []

stair = [1 for i in range(N+2)]

for i in range(M):

    stair[int(eval(input()))] = 0



dp = [0 for i in range(N+2)]

dp[0] = 1



MOD = 1000000007



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

    if stair[i] == 1:

        if i == 1:

            dp[i] = dp[i - 1] % MOD

        else:

            dp[i] = (dp[i-1] % MOD + dp[i-2] % MOD) % MOD



print((dp[N]))

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

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

-stair = [1 for i in range(N + 1)] +stair = [1 for i in range(N + 2)] -dp[1] = 1 +dp[0] = 1 -for i in range(2, N + 2): -    if stair[i - 1] == 1: -        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD -print((dp[N + 1])) +for i in range(1, N + 1): +    if stair[i] == 1: +        if i == 1: +            dp[i] = dp[i - 1] % MOD +        else: +            dp[i] = (dp[i - 1] % MOD + dp[i - 2] % MOD) % MOD +print((dp[N]))