P = 943718401 n, x = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) ans = 0 for j in range(n + 1): for k in range(n + 1 - j): ans += A[j + k] * B[j] % P * C[k] % P * pow(x, (j + k) * j * k, P) % P print(ans % P)