import sys input = sys.stdin.readline N,M,k=map(int,input().split()) mod=998244353 DP=[0]*(N*M+8) DP[0]=1 for i in range(N*M): for j in range(1,7): DP[i+j]=(DP[i+j]+DP[i])%mod C=list(map(int,input().split())) for c in C: # cを通る ANS=0 for i in range(1,7): ANS+=DP[c]*DP[N*M-i-c]*(6-i+1) #print(ANS) # c+Nを通る for i in range(1,7): if c+N<=N*M-i: ANS+=DP[c+N]*DP[N*M-i-(c+N)]*(6-i+1) #print(ANS) # cとc+Nを通る for i in range(1,7): if c+N<=N*M-i: ANS-=DP[c]*DP[N]*DP[N*M-i-(c+N)]*(6-i+1) print(ANS%mod)