L,M,N = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) BN = 50 n = N//BN + 1 A2 = [0] * (n) B2 = [0] * (n) of = 1 << BN for a in A: x = a // BN y = a % BN A2[x] ^= (1 << y) for b in B: x = b // BN y = b % BN B2[x] ^= (1 << y) for i in range(int(input())): ans = 0 for j in range(n): ans += (A2[j] & B2[j]).bit_count() print(ans) carry = 0 for i in range(n): B2[i] <<= 1 B2[i] |= carry if B2[i] & of: carry = 1 B2[i] ^= of else: carry = 0