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

a=[1 for i in range(n+2)]

for i in range(m):

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

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

dp[0]=1

for i in range(n):

    if ((i+1)<(n+1)) and a[i+1]:

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

    if ((i+2)<(n+1)) and a[i+2]:

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

print((dp[n]%1000000007))

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

a=[1 for i in range(n+2)]

for i in range(m):

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

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

dp[0]=1

for i in range(n):

    if ((i+1)<(n+1)) and a[i+1]:

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

    if ((i+2)<(n+1)) and a[i+2]:

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

print((dp[n]))

n, m = list(map(int, input().split()))
a = [1 for i in range(n + 2)]
for i in range(m):
    a[int(eval(input()))] = 0
dp = [0 for i in range(n + 1)]
dp[0] = 1
for i in range(n):
    if ((i + 1) < (n + 1)) and a[i + 1]:
        dp[i + 1] += dp[i]
    if ((i + 2) < (n + 1)) and a[i + 2]:
        dp[i + 2] += dp[i]
print((dp[n] % 1000000007))

n, m = list(map(int, input().split()))
a = [1 for i in range(n + 2)]
for i in range(m):
    a[int(eval(input()))] = 0
dp = [0 for i in range(n + 1)]
dp[0] = 1
for i in range(n):
    if ((i + 1) < (n + 1)) and a[i + 1]:
        dp[i + 1] = (dp[i + 1] + dp[i]) % 1000000007
    if ((i + 2) < (n + 1)) and a[i + 2]:
        dp[i + 2] += (dp[i + 2] + dp[i]) % 1000000007
print((dp[n]))

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