program sample
	implicit none
    integer ::x,y,z,e,f,i,k,l,M
    integer,allocatable :: a(:),b(:),c(:,:),d(:)
    
    read(*,*) x,y,M
    
    allocate(a(x))
    allocate(b(y))
    allocate(c(M,3))
    allocate(d(M+1))
    
    do i=1,size(d)+1
    	d(i)=0
    end do
    
    read(*,*) a
    read(*,*) b
    read(*,*) c

    e=minval(a)
    f=minval(b)
    d(1) = e+f   
   
   do i=2,z+1
    	k=c(i-1,1)
        l=c(i-2,2)
        d(i)= a(k) +b(k)-c(i-1,3)
    end do


    write(*,*) minval(d)
    
    deallocate(a)
    deallocate(b)
    deallocate(c)
    deallocate(d)
    
    stop
end program sample