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



broken = [0] * (n+1)

dp = [0] * (n+1)



for _ in range(m):

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

  if sum(broken[-2:]) == 2:

    print((0))

    exit()



dp[0] = 1



if broken[1] == 1:

  dp[1] = 0

else:

  dp[1] = 1



if n == 1:

  print((dp[n]))

  exit()

else:

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

    if broken[i] == 1:

      continue

    else:

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



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



broken = [0] * (n+1)

dp = [0] * (n+1)



for _ in range(m):

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

  if broken[-1] == 1 and broken[-2] == 1:

    print((0))

    exit()



dp[0] = 1



if broken[1] == 1:

  dp[1] = 0

else:

  dp[1] = 1



if n == 1:

  print((dp[n]))

  exit()

else:

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

    if broken[i] == 1:

      continue

    else:

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



print((dp[n]))
n, m = list(map(int, input().split()))
broken = [0] * (n + 1)
dp = [0] * (n + 1)
for _ in range(m):
    broken[int(eval(input()))] = 1
    if sum(broken[-2:]) == 2:
        print((0))
        exit()
dp[0] = 1
if broken[1] == 1:
    dp[1] = 0
else:
    dp[1] = 1
if n == 1:
    print((dp[n]))
    exit()
else:
    for i in range(2, n + 1):
        if broken[i] == 1:
            continue
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print((dp[n]))

n, m = list(map(int, input().split()))
broken = [0] * (n + 1)
dp = [0] * (n + 1)
for _ in range(m):
    broken[int(eval(input()))] = 1
    if broken[-1] == 1 and broken[-2] == 1:
        print((0))
        exit()
dp[0] = 1
if broken[1] == 1:
    dp[1] = 0
else:
    dp[1] = 1
if n == 1:
    print((dp[n]))
    exit()
else:
    for i in range(2, n + 1):
        if broken[i] == 1:
            continue
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print((dp[n]))

-    if sum(broken[-2:]) == 2: +    if broken[-1] == 1 and broken[-2] == 1: