import sys input = sys.stdin.readline N, X, Y = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 MOD = 998244353 for b in range(20): x = 0 for Ai in A: x += (Ai>>b)&1 y = 0 for Bi in B: y += (Bi>>b)&1 dp = [[0]*2 for _ in range(N+1)] dp[0][0] = 1 for i in range(N): dp[i+1][0] = (((X-x)*(Y-y)+(X-x)*y+x*(Y-y))*dp[i][0]+((X-x)*(Y-y)+x*(Y-y))*dp[i][1]) dp[i+1][1] = (x*y*dp[i][0]+((X-x)*y+x*y)*dp[i][1]) ans += (1<