Module Hitachi2020B

    Sub Main()

        Dim i, j As Integer
        Dim A, B, M As Integer
        Dim Min_A As Integer : Min_A = 10000
        Dim Min_B As Integer : Min_B = 10000
        Dim x, y, c As Integer
        Dim arr(3) As String
        Dim arr_A() As Integer
        Dim arr_B() As Integer
        Dim min As Integer : min = 20000

        arr = Split(Console.ReadLine())
        A = Integer.Parse(arr(0))
        B = Integer.Parse(arr(1))
        M = Integer.Parse(arr(2))

        '冷蔵庫の読込
        ReDim arr(A - 1)
        ReDim arr_A(A - 1)
        arr = Split(Console.ReadLine())

        '電子レンジの読込
        ReDim arr(B - 1)
        ReDim arr_B(B - 1)
        arr = Split(Console.ReadLine())

        '割引を使わなかった場合の最安値を取得
        For i = 0 To Math.Max(A, B) - 1
            If i < A Then
                arr_A(i) = Integer.Parse(arr(i))
                If arr_A(i) < Min_A Then
                    Min_A = arr_A(i)
                End If
            End If
            If i < B Then
                arr_B(i) = Integer.Parse(arr(i))
                If arr_B(i) < Min_B Then
                    Min_B = arr_B(i)
                End If
            End If
        Next
        min = Min_A + Min_B

        '割引の読込
        For i = 0 To M - 1
            arr = Split(Console.ReadLine())
            x = Integer.Parse(arr(0))
            y = Integer.Parse(arr(1))
            c = Integer.Parse(arr(2))
            If arr_A(x - 1) + arr_B(y - 1) - c < min Then
                min = arr_A(x - 1) + arr_B(y - 1) - c
            End If
        Next

        Console.Write(min)

    End Sub
End Module
