fun main(args : Array<String>) {
    val (a, b, m) = readLine()!!.split(" ").map { it.toInt() }
    val aa = readLine()!!.split(" ").map { it.toInt() }
    val bb = readLine()!!.split(" ").map { it.toInt() }

    var min = aa.min()!! + bb.min()!!

    repeat(m) {
        val (x, y, c) = readLine()!!.split(" ").map { it.toInt() }
        val discounted = aa[x-1] + bb[y-1] - c
        if (discounted < min) {
            min = discounted
        }
    }

    println(min)
}