n, m, w = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(lambda x: -int(x), input().split())) d = list(map(lambda x: -int(x), input().split())) ac = a + c bd = b + d k = n + m weight = [0] * (1 << k) value = [0] * (1 << k) for i in range(1<