program main
	implicit none
    integer::a,b,m,min2,i,x,y,z
    integer::min1
    integer,allocatable::c(:),d(:)
    read(*,*) a,b,m
    min2=200000
    allocate(c(a))
    allocate(d(b))
    read(*,*) c
    read(*,*) d
    
    min1=minval(c)+minval(d)
    do i=1,m
    	read(*,*) x,y,z
        if(c(x)+d(y)-z<min2)then
        	min2=c(x)+d(y)-z
        end if
    end do
    
    if(min1<min2)then
    	write(*,*) min1
    else
    	write(*,*) min2
    end if
    deallocate(c)
    deallocate(d)
    
    stop
end program main
