fun main(arr: Array<String>) {
    val (a,b,m) = readLine()!!.split(" ").map { it.toInt() }
    val fridge = readLine()!!.split(" ").map { it.toInt() }
    val microwave = readLine()!!.split(" ").map { it.toInt() }
    val coupon = (1..m).map { readLine()!!.split(" ").map { it.toInt() } }
    var ans = fridge.min()!! + microwave.min()!!
    for(c in coupon) {
        ans = Math.min(ans, fridge[c[0]-1] + microwave[c[1]-1] - c[2])
    }
    println(ans)
}