L,M,N = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) Q = int(input()) A.sort() B.sort() h = [A[0] - B[i] for i in reversed(range(M))] delta = [A[i] - A[0] for i in range(L)] import sys sabun = -h[0] n = h[-1] + sabun x = [0] * (n + 1) for i in h: x[sabun + i] += 1 m = delta[-1] y = [0] * (m + 1) for i in delta: y[i] += 1 import cmath #FFT 配列のサイズは2べきのみ #逆変換はinverse = True #配列Aは壊れる def fft(A,inverse = False): N = len(A) h = 0 while 1 << h < N: h += 1 for i in range(N): j = 0 for k in range(h): j |= (i >> k & 1) << (h-1-k) if i < j: A[i],A[j] = A[j],A[i] #↑バタフライ演算用配列整備 b = 1 if inverse:c = -1 else:c = 1 while b < N: for j in range(b): w = cmath.rect(1.0,-cmath.pi * j / b * c) for k in range(0,N,2*b): s = A[j+k] t = A[j+k+b] * w A[j+k] = s + t A[j+k+b] = s - t b *= 2 if inverse: for i in range(N): A[i] /= N return A def convolve(a,b): s = len(a) + len(b) - 1 t = 1 while t < s: t <<= 1 A = a + [0] * (t - len(a)) B = b + [0] * (t - len(b)) A = fft(A) B = fft(B) for i in range(t): A[i] *= B[i] A = fft(A,True) return A[:s] #↓整数版、配列は壊れない def Zconvolve(a,b): A = convolve(a,b) for i in range(len(A)): A[i] = round(A[i].real) return A C = Zconvolve(x,y) for i in range(Q): if sabun + i >= len(C): print(0) else: print(C[sabun+i])