L,M,N = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) n = N//30 + 1 A2 = [0] * (n) B2 = [0] * (n) of = 1 << 30 for a in A: x = a // 30 y = a % 30 A2[x] ^= (1 << y) for b in B: x = b // 30 y = b % 30 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