fun main(array: Array<String>) {
    val (a, b, m) = readLine()!!.split(" ").map { it.toInt() }
    val aList = readLine()!!.split(" ").map { it.toInt() }
    val bList = readLine()!!.split(" ").map { it.toInt() }
    var min = aList.min()!! + bList.min()!!
    repeat(m) {
        var temp = readLine()!!.split(" ").map { it.toInt() }
        var tempMin = aList[temp[0]-1] + bList[temp[1]-1] - temp[2]
        min = if(tempMin <= min) {
            tempMin
        }
        else {
            min
        }
    }
    print(min)
}