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

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

MOD = 10**9 + 7

dp = [0] * (N + 1)

dp[0] = 1

dp[1] = 0 if 1 in aset else 1

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

    if i not in aset:

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

print((dp[-1] % MOD))

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

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

dp = [0] * (N + 1)

dp[0] = 1

for i in range(N):

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

        if j not in aset:

            dp[j] += dp[i]

            dp[j] %= 10**9 + 7

print((dp[N]))

N, M = list(map(int, input().split()))
aset = set([int(eval(input())) for _ in range(M)])
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in aset else 1
for i in range(2, N + 1):
    if i not in aset:
        dp[i] = dp[i - 1] + dp[i - 2]
print((dp[-1] % MOD))

N, M = list(map(int, input().split()))
aset = set([int(eval(input())) for _ in range(M)])
dp = [0] * (N + 1)
dp[0] = 1
for i in range(N):
    for j in range(i + 1, min(N, i + 2) + 1):
        if j not in aset:
            dp[j] += dp[i]
            dp[j] %= 10**9 + 7
print((dp[N]))

-MOD = 10**9 + 7 -dp[1] = 0 if 1 in aset else 1 -for i in range(2, N + 1): -    if i not in aset: -        dp[i] = dp[i - 1] + dp[i - 2] -print((dp[-1] % MOD)) +for i in range(N): +    for j in range(i + 1, min(N, i + 2) + 1): +        if j not in aset: +            dp[j] += dp[i] +            dp[j] %= 10**9 + 7 +print((dp[N]))