mod = 10**9+7

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

A_ = [int(eval(input())) for _ in range(M)]

A = [0] * (N+1)

for a in A_:

    A[a] = 1

dp = [0] * (N+3)

dp[0] = 1

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

    if A[i-1] == 0:

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

    if A[i-2] == 0:

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

    dp[i] %= mod

print((dp[N]))

mod = 10**9+7

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

A_ = [int(eval(input())) for _ in range(M)]

A = [0] * (N+3)

for a in A_:

    A[a] = 1

dp = [0] * (N+3)

dp[0] = 1

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

    if A[i-1] == 0:

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

    if A[i-2] == 0:

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

    dp[i] %= mod

print((dp[N]))

mod = 10**9 + 7
N, M = list(map(int, input().split()))
A_ = [int(eval(input())) for _ in range(M)]
A = [0] * (N + 1)
for a in A_:
    A[a] = 1
dp = [0] * (N + 3)
dp[0] = 1
for i in range(1, N + 1):
    if A[i - 1] == 0:
        dp[i] += dp[i - 1]
    if A[i - 2] == 0:
        dp[i] += dp[i - 2]
    dp[i] %= mod
print((dp[N]))

mod = 10**9 + 7
N, M = list(map(int, input().split()))
A_ = [int(eval(input())) for _ in range(M)]
A = [0] * (N + 3)
for a in A_:
    A[a] = 1
dp = [0] * (N + 3)
dp[0] = 1
for i in range(1, N + 1):
    if A[i - 1] == 0:
        dp[i] += dp[i - 1]
    if A[i - 2] == 0:
        dp[i] += dp[i - 2]
    dp[i] %= mod
print((dp[N]))

-A = [0] * (N + 1) +A = [0] * (N + 3)