using System; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Diagnostics; using System.Numerics; using Enu = System.Linq.Enumerable; public class Program { public void Solve() { int L = Reader.Int(), M = Reader.Int(), N = Reader.Int(); var A = Reader.IntArray(L); var B = Reader.IntArray(M); int Q = Reader.Int(); var X = new int[N + 1]; var Y = new int[N + 1]; foreach (int a in A) X[a] = 1; foreach (int b in B) Y[N - b] = 1; var res = new FFTMod().Mult(X, Y); Console.WriteLine(string.Join("\n", res.Skip(N).Take(Q))); } } class FFTMod { int Mod, PrimitiveRoot; public long[] Mult(int[] A, int[] B) { return Mult(A, B, 167772161, 3); } public long[] Mult(int[] A, int[] B, int mod, int primitiveRoot) { Mod = mod; PrimitiveRoot = primitiveRoot; int N = A.Length + B.Length - 1; int N2 = N; while ((N2 & N2 - 1) != 0) N2 += N2 & -N2; long[] a = new long[N2], b = new long[N2]; for (int i = 0; i < A.Length; i++) a[i] = A[i]; for (int i = 0; i < B.Length; i++) b[i] = B[i]; Transform(a); Transform(b); for (int i = 0; i < N2; i++) a[i] = a[i] * b[i] % Mod; Transform(a, true); long inv = Power(N2, Mod - 2); for (int i = 0; i < N2; i++) a[i] = a[i] * inv % mod; return a; } void Transform(long[] A, bool inv = false) { int N = A.Length; long H = Power(PrimitiveRoot, (Mod - 1) / N); if (inv) H = Power(H, Mod - 2); for (int a = 0, b = 0; b < N; ++b) { if (b < a) { var t = A[a]; A[a] = A[b]; A[b] = t; } for (int k = N >> 1; k > (a ^= k); k >>= 1) { } } for (int m = 1; m < N; m <<= 1) { int m2 = m << 1; long b = Power(H, N / m2); long w = 1; for (int a = 0; a < m; ++a, w = w * b % Mod) for (int k = a; k < N; k += m2) { long x = A[k]; long y = A[k + m] * w % Mod; long tx = x + y; long ty = x - y; A[k] = tx >= Mod ? tx - Mod : tx; A[k + m] = ty < 0 ? ty + Mod : ty; } } } long Power(long x, long n) { long res = 1; if ((x %= Mod) < 0) x += Mod; for (; n > 0; n >>= 1, x = x * x % Mod) if ((n & 1) == 1) res = res * x % Mod; return res; } } class Entry { static void Main() { new Program().Solve(); } } class Reader { static TextReader reader = Console.In; static readonly char[] separator = { ' ' }; static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries; static string[] A = new string[0]; static int i; static void Init() { A = new string[0]; } public static void Set(TextReader r) { reader = r; Init(); } public static void Set(string file) { reader = new StreamReader(file); Init(); } public static bool HasNext() { return CheckNext(); } public static string String() { return Next(); } public static int Int() { return int.Parse(Next()); } public static long Long() { return long.Parse(Next()); } public static double Double() { return double.Parse(Next()); } public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); } public static int[] IntArray(int N) { return Range(N, Int); } public static int[][] IntTable(int H) { return Range(H, IntLine); } public static string[] StringArray(int N) { return Range(N, Next); } public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); } public static string Line() { return reader.ReadLine().Trim(); } public static T[] Range(int N, Func f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; } static string[] Split(string s) { return s.Split(separator, op); } static string Next() { CheckNext(); return A[i++]; } static bool CheckNext() { if (i < A.Length) return true; string line = reader.ReadLine(); if (line == null) return false; if (line == "") return CheckNext(); A = Split(line); i = 0; return true; } }