n,m=[int(i) for i in input().split()]

dp=[1,1] ;a=set() ; mod=(10**9+7)

for i in range(m):

    a.add(int(eval(input())))

if 1 in a: dp[1]=0

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

    if i not in a:

        dp.append((dp[-1]+dp[-2])%mod)

    else:

        dp.append(0)

print((dp[-1]))

    

import sys

input = lambda: sys.stdin.readline().rstrip()

n,m=[int(i) for i in input().split()]

dp=[1,1] ;a=set() ; mod=(10**9+7)

for i in range(m):

    a.add(int(eval(input())))

if 1 in a: dp[1]=0

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

    if i not in a:

        dp.append((dp[-1]+dp[-2])%mod)

    else:

        dp.append(0)

print((dp[-1]))

    

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

import sys

input = lambda: sys.stdin.readline().rstrip()
n, m = [int(i) for i in input().split()]
dp = [1, 1]
a = set()
mod = 10**9 + 7
for i in range(m):
    a.add(int(eval(input())))
if 1 in a:
    dp[1] = 0
for i in range(2, n + 1):
    if i not in a:
        dp.append((dp[-1] + dp[-2]) % mod)
    else:
        dp.append(0)
print((dp[-1]))

+import sys + +input = lambda: sys.stdin.readline().rstrip()