N, M = list(map(int, input().split()))

MOD = 10**9 + 7

F = [0]*(N+1)

for i in range(M):

    F[int(eval(input()))-1] = 1



a = 1; b = 0

for i in range(N):

    if F[i]:

        a, b = 0, a

    else:

        a, b = (a+b) % MOD, a

print(a)

N, M, *C = list(map(int, open(0).read().split()))

MOD = 10**9 + 7

F = [0]*(N+1)

for c in C:

    F[c-1] = 1



a = 1; b = 0

for i in range(N):

    if F[i]:

        a, b = 0, a

    else:

        a, b = ((a+b) % MOD), a

print(a)
N, M = list(map(int, input().split()))
MOD = 10**9 + 7
F = [0] * (N + 1)
for i in range(M):
    F[int(eval(input())) - 1] = 1
a = 1
b = 0
for i in range(N):
    if F[i]:
        a, b = 0, a
    else:
        a, b = (a + b) % MOD, a
print(a)

N, M, *C = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
F = [0] * (N + 1)
for c in C:
    F[c - 1] = 1
a = 1
b = 0
for i in range(N):
    if F[i]:
        a, b = 0, a
    else:
        a, b = ((a + b) % MOD), a
print(a)

-N, M = list(map(int, input().split())) +N, M, *C = list(map(int, open(0).read().split())) -for i in range(M): -    F[int(eval(input())) - 1] = 1 +for c in C: +    F[c - 1] = 1 -        a, b = (a + b) % MOD, a +        a, b = ((a + b) % MOD), a