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

mod = 10**9 + 7

dp = [0 for i in range(n+1)]

for i in range(m):

    dp[int(eval(input()))] = -1

dp[0] = 1

for i in range(n):

    if dp[i] != -1:

        if dp[i+1] != -1:

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

            dp[i+1] %= mod

        if i+2 <= n and dp[i+2] != -1:

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

            dp[i+2] %= mod

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

dp = [0 for i in range(n + 1)]

mod = 10 ** 9 + 7

broke = set()

for i in range(m):

    broke.add(int(eval(input())))

dp[0] = 1

for i in range(n):

    if i + 1 <= n and i + 1 not in broke:

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

        dp[i + 1] %= mod

    if i + 2 <= n and i + 2 not in broke:

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

        dp[i + 2] %= mod

print((dp[-1] % mod))
n, m = list(map(int, input().split()))
mod = 10**9 + 7
dp = [0 for i in range(n + 1)]
for i in range(m):
    dp[int(eval(input()))] = -1
dp[0] = 1
for i in range(n):
    if dp[i] != -1:
        if dp[i + 1] != -1:
            dp[i + 1] += dp[i]
            dp[i + 1] %= mod
        if i + 2 <= n and dp[i + 2] != -1:
            dp[i + 2] += dp[i]
            dp[i + 2] %= mod
print((dp[n]))

n, m = list(map(int, input().split()))
dp = [0 for i in range(n + 1)]
mod = 10**9 + 7
broke = set()
for i in range(m):
    broke.add(int(eval(input())))
dp[0] = 1
for i in range(n):
    if i + 1 <= n and i + 1 not in broke:
        dp[i + 1] += dp[i]
        dp[i + 1] %= mod
    if i + 2 <= n and i + 2 not in broke:
        dp[i + 2] += dp[i]
        dp[i + 2] %= mod
print((dp[-1] % mod))

+dp = [0 for i in range(n + 1)] -dp = [0 for i in range(n + 1)] +broke = set() -    dp[int(eval(input()))] = -1 +    broke.add(int(eval(input()))) -    if dp[i] != -1: -        if dp[i + 1] != -1: -            dp[i + 1] += dp[i] -            dp[i + 1] %= mod -        if i + 2 <= n and dp[i + 2] != -1: -            dp[i + 2] += dp[i] -            dp[i + 2] %= mod -print((dp[n])) +    if i + 1 <= n and i + 1 not in broke: +        dp[i + 1] += dp[i] +        dp[i + 1] %= mod +    if i + 2 <= n and i + 2 not in broke: +        dp[i + 2] += dp[i] +        dp[i + 2] %= mod +print((dp[-1] % mod))