MOD = 10 ** 9 + 7



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



broken = [False for _ in range(N+1)]

for _ in range(M):

	broken[int(eval(input()))] = True



dp = [0 for _ in range(N + 1)]

dp[0] = 1

if(broken[1] == False):

  dp[1] = 1



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

	if broken[i]:

		continue

	else:

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

		dp[i] %= MOD

print((dp[N]))
n, m = list(map(int, input().split()))

broken = [0]*(n+1)

#m個階段が壊れているからそれをbrokenに入れる

for i in range(m):

    a = int(eval(input()))

    broken[a] = 1

dp = [0]*(n+1)

dp[0] = 1

mod = 1000000007

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

    if broken[i]:

        continue

    #dp[-1]は0だから上手く回る

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

print((dp[n]))

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

n, m = list(map(int, input().split()))
broken = [0] * (n + 1)
# m個階段が壊れているからそれをbrokenに入れる
for i in range(m):
    a = int(eval(input()))
    broken[a] = 1
dp = [0] * (n + 1)
dp[0] = 1
mod = 1000000007
for i in range(1, n + 1):
    if broken[i]:
        continue
    # dp[-1]は0だから上手く回る
    dp[i] = (dp[i - 1] + dp[i - 2]) % mod
print((dp[n]))

-MOD = 10**9 + 7 -N, M = list(map(int, input().split())) -broken = [False for _ in range(N + 1)] -for _ in range(M): -    broken[int(eval(input()))] = True -dp = [0 for _ in range(N + 1)] +n, m = list(map(int, input().split())) +broken = [0] * (n + 1) +# m個階段が壊れているからそれをbrokenに入れる +for i in range(m): +    a = int(eval(input())) +    broken[a] = 1 +dp = [0] * (n + 1) -if broken[1] == False: -    dp[1] = 1 -for i in range(2, N + 1): +mod = 1000000007 +for i in range(1, n + 1): -    else: -        dp[i] = dp[i - 1] + dp[i - 2] -        dp[i] %= MOD -print((dp[N])) +    # dp[-1]は0だから上手く回る +    dp[i] = (dp[i - 1] + dp[i - 2]) % mod +print((dp[n]))