def main():

  import sys

  input = sys.stdin.readline

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

  mod=pow(10,9)+7

  ans=[1]*(n+1)

  for _ in [0]*m:

    ans[int(eval(input()))]=0

  for i in range(n+1):

    ans[i]=ans[i] if ans[i]==0 or i<2 else (ans[i-1]+ans[i-2])%mod

  print((ans[-1]))

if __name__ == '__main__':

    main()
def main():

  import sys

  input = sys.stdin.readline

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

  mod=pow(10,9)+7

  ans=[1]*(n+1)

  for _ in [0]*m:

    ans[int(eval(input()))]=0

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

    if ans[i]>0:

      ans[i]=(ans[i-1]+ans[i-2])%mod

  print((ans[-1]))

if __name__ == '__main__':

    main()
def main():
    import sys

    input = sys.stdin.readline
    n, m = list(map(int, input().split()))
    mod = pow(10, 9) + 7
    ans = [1] * (n + 1)
    for _ in [0] * m:
        ans[int(eval(input()))] = 0
    for i in range(n + 1):
        ans[i] = ans[i] if ans[i] == 0 or i < 2 else (ans[i - 1] + ans[i - 2]) % mod
    print((ans[-1]))


if __name__ == "__main__":
    main()

def main():
    import sys

    input = sys.stdin.readline
    n, m = list(map(int, input().split()))
    mod = pow(10, 9) + 7
    ans = [1] * (n + 1)
    for _ in [0] * m:
        ans[int(eval(input()))] = 0
    for i in range(2, n + 1):
        if ans[i] > 0:
            ans[i] = (ans[i - 1] + ans[i - 2]) % mod
    print((ans[-1]))


if __name__ == "__main__":
    main()

-    for i in range(n + 1): -        ans[i] = ans[i] if ans[i] == 0 or i < 2 else (ans[i - 1] + ans[i - 2]) % mod +    for i in range(2, n + 1): +        if ans[i] > 0: +            ans[i] = (ans[i - 1] + ans[i - 2]) % mod