a, b, m = list(map(int,input().split()))

dr = list(map(int,input().split()))

wa = list(map(int,input().split()))

xyc = [list(map(int,input().split())) for i in range(m)]

low = 200001



for i in range(m):

    f = xyc[i][0] - 1

    d = xyc[i][1] - 1

    if low >= dr[f]+wa[d]-xyc[i][2]:

        low = dr[f]+wa[d]-xyc[i][2]



dr.sort()

wa.sort()



if low >= (dr[0] + wa[0]):

    print((dr[0] + wa[0]))

else:

    print(low)
a, b, m = list(map(int,input().split()))

al = list(map(int,input().split()))

bl = list(map(int,input().split()))

low = min(al)+min(bl)

x = [0] * m

y = [0] * m

c = [0] * m



for i in range(m):

    x[i],y[i],c[i] = list(map(int, input().split()))

    x[i] -= 1

    y[i] -= 1

 

for i in range(m):

    low = min(low,al[x[i]]+bl[y[i]]-c[i])



print(low)
a, b, m = list(map(int, input().split()))
dr = list(map(int, input().split()))
wa = list(map(int, input().split()))
xyc = [list(map(int, input().split())) for i in range(m)]
low = 200001
for i in range(m):
    f = xyc[i][0] - 1
    d = xyc[i][1] - 1
    if low >= dr[f] + wa[d] - xyc[i][2]:
        low = dr[f] + wa[d] - xyc[i][2]
dr.sort()
wa.sort()
if low >= (dr[0] + wa[0]):
    print((dr[0] + wa[0]))
else:
    print(low)

a, b, m = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
low = min(al) + min(bl)
x = [0] * m
y = [0] * m
c = [0] * m
for i in range(m):
    x[i], y[i], c[i] = list(map(int, input().split()))
    x[i] -= 1
    y[i] -= 1
for i in range(m):
    low = min(low, al[x[i]] + bl[y[i]] - c[i])
print(low)

-dr = list(map(int, input().split())) -wa = list(map(int, input().split())) -xyc = [list(map(int, input().split())) for i in range(m)] -low = 200001 +al = list(map(int, input().split())) +bl = list(map(int, input().split())) +low = min(al) + min(bl) +x = [0] * m +y = [0] * m +c = [0] * m -    f = xyc[i][0] - 1 -    d = xyc[i][1] - 1 -    if low >= dr[f] + wa[d] - xyc[i][2]: -        low = dr[f] + wa[d] - xyc[i][2] -dr.sort() -wa.sort() -if low >= (dr[0] + wa[0]): -    print((dr[0] + wa[0])) -else: -    print(low) +    x[i], y[i], c[i] = list(map(int, input().split())) +    x[i] -= 1 +    y[i] -= 1 +for i in range(m): +    low = min(low, al[x[i]] + bl[y[i]] - c[i]) +print(low)