def mi():return list(map(int,input().split()))

import numpy as np

A,B,M=mi()

a=np.array(list(mi()))

b=np.array(list(mi()))

minab=min(a)+min(b)



ans=float("inf")



for i in range(M):

    x,y,c=mi()

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

    ans=min(ans,tmp)

print((min(ans,minab)))

def mi():return list(map(int,input().split()))

A,B,M=mi()

a=list(mi())

b=list(mi())

ans=min(a)+min(b)

for _ in range(M):

    x,y,c=mi()

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

print(ans)
def mi():
    return list(map(int, input().split()))


import numpy as np

A, B, M = mi()
a = np.array(list(mi()))
b = np.array(list(mi()))
minab = min(a) + min(b)
ans = float("inf")
for i in range(M):
    x, y, c = mi()
    tmp = a[x - 1] + b[y - 1] - c
    ans = min(ans, tmp)
print((min(ans, minab)))

def mi():
    return list(map(int, input().split()))


A, B, M = mi()
a = list(mi())
b = list(mi())
ans = min(a) + min(b)
for _ in range(M):
    x, y, c = mi()
    ans = min(ans, a[x - 1] + b[y - 1] - c)
print(ans)

-import numpy as np - -a = np.array(list(mi())) -b = np.array(list(mi())) -minab = min(a) + min(b) -ans = float("inf") -for i in range(M): +a = list(mi()) +b = list(mi()) +ans = min(a) + min(b) +for _ in range(M): -    tmp = a[x - 1] + b[y - 1] - c -    ans = min(ans, tmp) -print((min(ans, minab))) +    ans = min(ans, a[x - 1] + b[y - 1] - c) +print(ans)