program prob2
    implicit none
    integer :: a,b,m,ans,i
    integer, allocatable :: va(:), vb(:), x(:), y(:), vc(:)

    read(*,*) a,b,m
    allocate(va(a))
    allocate(vb(b))
    allocate(x(m))
    allocate(y(m))
    allocate(vc(m))
    
    read(*,*) va
    read(*,*) vb
    do i = 1, m
        read(*,*) x(i), y(i), vc(i)
    end do
    ans = minval(va) + minval(vb)

    do i = 1, m
        if(va(x(i)) + vb(y(i)) - vc(i) < ans) then
            ans = va(x(i)) + vb(y(i)) - vc(i)
        end if
    end do

    write(*,'(i6)') ans



    stop
contains
end program prob2