from typing import List MOD = int(1e9) + 7 def xorConvolution(a: List[int], b: List[int]) -> List[int]: a, b = a[:], b[:] a = _walshHadamardTransform(a, 1) b = _walshHadamardTransform(b, 1) for i in range(len(a)): a[i] = a[i] * b[i] % MOD res = _walshHadamardTransform(a, (MOD + 1) // 2) return res def _walshHadamardTransform(f, op): n = len(f) l, k = 2, 1 while l <= n: for i in range(0, n, l): for j in range(k): f[i + j], f[i + j + k] = (f[i + j] + f[i + j + k]) * op % MOD, ( f[i + j] + MOD - f[i + j + k] ) * op % MOD l, k = l << 1, k << 1 return f if __name__ == "__main__": n, m, k = map(int, input().split()) nums1 = list(map(int, input().split())) nums2 = list(map(int, input().split())) MAX = 1024 f, g = [0] * MAX, [0] * MAX f[0], g[0] = 1, 1 xor_ = 0 for num in nums1: xor_ ^= num f[xor_] += 1 xor_ = 0 for num in nums2: xor_ ^= num g[xor_] += 1 f, g = xorConvolution(f, f), xorConvolution(g, g) f[0], g[0] = (f[0] - n - 1) % MOD, (g[0] - m - 1) % MOD res = xorConvolution(f, g) print((res[k] // 4) % MOD)