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

A = {int(eval(input())) for _ in range(M)}



memo = [0] * (N + 1)

memo[0] = 0 if 0 in A else 1

memo[1] = 0 if 1 in A else 1



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

    if i in A:

        continue

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



print((memo[N] % 1000000007))
N, M = list(map(int, input().split(" ")))

A = {int(eval(input())) for _ in range(M)}



memo = [0] * (N + 1)

memo[0] = 1

memo[1] = 0 if 1 in A else 1



if N == 1:

    print((memo[1]))

else:

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

        if i in A:

            continue

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



    print((memo[N]))

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

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

-memo[0] = 0 if 0 in A else 1 +memo[0] = 1 -for i in range(2, N + 1): -    if i in A: -        continue -    memo[i] = memo[i - 2] + memo[i - 1] -print((memo[N] % 1000000007)) +if N == 1: +    print((memo[1])) +else: +    for i in range(2, N + 1): +        if i in A: +            continue +        memo[i] = (memo[i - 2] + memo[i - 1]) % 1000000007 +    print((memo[N]))