n,m = list(map(int,input().split()))

judge = [True for i in range(n+1)]

for i in range(m):

    judge[int(eval(input()))] = False

dp = [0]*(n+1)

dp[0] = 1

for i in range(n):

    if judge[i + 1]:dp[i+1] += dp[i]

    if i + 2 > n:continue

    if judge[i + 2]:dp[i+2] += dp[i]

print((dp[-1]%1000000007))
n,m = list(map(int,input().split()))

judge = [True for i in range(n+1)]

for i in range(m):

    judge[int(eval(input()))] = False

dp = [0]*(n+1)

dp[0] = 1

for i in range(n):

    if i + 1 > n:continue

    if judge[i + 1]:dp[i+1] = (dp[i] +dp[i+1]) %1000000007

    if i + 2 > n:continue

    if judge[i + 2]:dp[i+2] = (dp[i] + dp[i+2]) %1000000007

print((dp[-1]%1000000007))
n, m = list(map(int, input().split()))
judge = [True for i in range(n + 1)]
for i in range(m):
    judge[int(eval(input()))] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
    if judge[i + 1]:
        dp[i + 1] += dp[i]
    if i + 2 > n:
        continue
    if judge[i + 2]:
        dp[i + 2] += dp[i]
print((dp[-1] % 1000000007))

n, m = list(map(int, input().split()))
judge = [True for i in range(n + 1)]
for i in range(m):
    judge[int(eval(input()))] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
    if i + 1 > n:
        continue
    if judge[i + 1]:
        dp[i + 1] = (dp[i] + dp[i + 1]) % 1000000007
    if i + 2 > n:
        continue
    if judge[i + 2]:
        dp[i + 2] = (dp[i] + dp[i + 2]) % 1000000007
print((dp[-1] % 1000000007))

+    if i + 1 > n: +        continue -        dp[i + 1] += dp[i] +        dp[i + 1] = (dp[i] + dp[i + 1]) % 1000000007 -        dp[i + 2] += dp[i] +        dp[i + 2] = (dp[i] + dp[i + 2]) % 1000000007