program sample
	implicit none
    integer ::x,y,z,e,f,i,k,l
    integer,allocatable :: a(:),b(:),c(:,:),d(:)
    
    read(*,*) x,y,z
    
    allocate(a(x))
    allocate(b(y))
    allocate(c(3,z))
    allocate(d(z+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,lは何番目の冷蔵庫と電子レンジが割引になるか示す。
    	k=c(1,i-1)
        l=c(2,i-1)
        d(i)= a(k) +b(k)-c(3,i-1)
    end do

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