using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); static void Main() { var c = NList; var (n, x, y) = (c[0], c[1], c[2]); var a = NList; var b = NList; WriteLine(Xor((int)n, x, y, a, b)); } static long Xor(int n, long x, long y, long[] a, long[] b) { var res = 0L; var mod = 998_244_353L; for (var i = 0; i < 18; ++i) { long a1 = 0L; long b1 = 0L; foreach (var ai in a) a1 += (ai >> i) % 2; foreach (var bi in b) b1 += (bi >> i) % 2; long x_x = (long)x * y - a1 * b1; long x_o = a1 * b1; long o_x = x * (y - b1); long o_o = x * b1; var dp = new long[n + 1][]; for (var j = 0; j < dp.Length; ++j) dp[j] = new long[2]; dp[0][0] = 1; for (var j = 0; j + 1 < dp.Length; ++j) { dp[j + 1][0] = (dp[j][0] * x_x % mod + dp[j][1] * o_x % mod) % mod; dp[j + 1][1] = (dp[j][0] * x_o % mod + dp[j][1] * o_o % mod) % mod; } res = (res + (dp[n][1] << i)) % mod; } return (res); } }