program main
    implicit none
    integer a, b, m
    integer, allocatable, dimension(:) :: ai, bi, x, y, c
    integer i, value
    integer a_min, b_min, value_min

    read(*,*) a, b, m

    allocate(ai(a))
    allocate(bi(b))
    allocate(x(m))
    allocate(y(m))
    allocate(c(m))

    read(*,*) ai
    read(*,*) bi
    do i = 1,m
        read(*,*) x(i),y(i),c(i)
    end do

    a_min = ai(1)
    b_min = bi(1)
    
    do i = 1,a
        if(ai(i) <= a_min) then
            a_min = ai(i)
        end if
    end do

    do i = 1,b
        if(bi(i) <= b_min) then
            b_min = bi(i)
        end if
    end do

    value_min = a_min + b_min

    do i = 1,m
        value = ai(x(i)) + bi(y(i)) - c(i)
        if(value <= value_min) then
            value_min = value
        end if
    end do

    write(*,*) value_min


end program