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

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

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

count = min(a)+min(b)

for i in range(m):

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

  if count > a[x-1]+b[y-1]-c:

    count = a[x-1]+b[y-1]-c

    

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

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

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

ans=10**6

for i in range(m):

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

  ans=min(ans,a[x-1]+b[y-1]-c)

print((min(ans,min(a)+min(b))))
a, b, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = min(a) + min(b)
for i in range(m):
    x, y, c = list(map(int, input().split()))
    if count > a[x - 1] + b[y - 1] - c:
        count = a[x - 1] + b[y - 1] - c
print(count)

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

-count = min(a) + min(b) +ans = 10**6 -    if count > a[x - 1] + b[y - 1] - c: -        count = a[x - 1] + b[y - 1] - c -print(count) +    ans = min(ans, a[x - 1] + b[y - 1] - c) +print((min(ans, min(a) + min(b))))