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

a = set(int(eval(input())) for i in range(m))

#for i in range(m):

#  a.append(int(input()))

b=[0 for x in range(n+1)]

b[0]=1

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

  if i in a:

    continue

  x=b[i-1]

  if i>1:x+=b[i-2]

  b[i]=x

print((b[n]%(10**9+7)))
n,m=list(map(int,input().split()))

a = set(int(eval(input())) for i in range(m))

#for i in range(m):

#  a.append(int(input()))

b=[0 for x in range(n+1)]

b[0]=1

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

  if i in a:

    continue

  x=b[i-1]

  if i>1:x+=b[i-2]

  b[i]=x%(10**9+7)

print((b[n]))
n, m = list(map(int, input().split()))
a = set(int(eval(input())) for i in range(m))
# for i in range(m):
#  a.append(int(input()))
b = [0 for x in range(n + 1)]
b[0] = 1
for i in range(1, n + 1):
    if i in a:
        continue
    x = b[i - 1]
    if i > 1:
        x += b[i - 2]
    b[i] = x
print((b[n] % (10**9 + 7)))

n, m = list(map(int, input().split()))
a = set(int(eval(input())) for i in range(m))
# for i in range(m):
#  a.append(int(input()))
b = [0 for x in range(n + 1)]
b[0] = 1
for i in range(1, n + 1):
    if i in a:
        continue
    x = b[i - 1]
    if i > 1:
        x += b[i - 2]
    b[i] = x % (10**9 + 7)
print((b[n]))

-    b[i] = x -print((b[n] % (10**9 + 7))) +    b[i] = x % (10**9 + 7) +print((b[n]))