fun main(args: Array<String>) {
    val (A, B, M) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map { it.toInt() }
    val b = readLine()!!.split(" ").map { it.toInt() }
    println(Math.min(a.min()!! + b.min()!!, (1..M).map {
        val (x, y, c) = readLine()!!.split(" ").map { it.toInt() }
        a[x - 1] + b[y - 1] - c
    }.min()!!))
}