fun main(args: Array<String>) {
    val (a, b, m) = readIntegerList()
    val aList = readIntegerList()
    val bList = readIntegerList()
    val couponArray = Array(m) { readIntegerList() }

    val minA = aList.min()!!
    val minB = bList.min()!!
    val minNoC = minA + minB

    var min = Int.MAX_VALUE
    for (c in couponArray) {
        val tmp = aList[c[0] - 1] + bList[c[1] - 1] - c[2]
        min = Math.min(tmp, min)
    }

    println(Math.min(min, minNoC))
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
