fun main(args: Array<String>) {
    data class Coupon(val ai: Int, val bi: Int, val discount: Int)
    val (a, b, m) = readLine()!!.split(" ").map(String::toInt)
    val an = readLine()!!.split(" ").map(String::toInt)
    val bn = readLine()!!.split(" ").map(String::toInt)

    val coupons = Array(m) {
        val (ai, bi, dis) = readLine()!!.split(" ").map(String::toInt)
        Coupon(ai - 1, bi - 1, dis)
    }

    var min = an.min()!! + bn.min()!!

    for ((ai, bi, dis) in coupons) {
        min = Math.min(min, an[ai] + bn[bi] - dis)
    }
    println(min)
}



