#HITACHI2020B. Nice Shopping

Nice Shopping

Score : 200200 points

Problem Statement

You are visiting a large electronics store to buy a refrigerator and a microwave.

The store sells AA kinds of refrigerators and BB kinds of microwaves. The ii-th refrigerator ( 1iA1 \le i \le A ) is sold at aia_i yen (the currency of Japan), and the jj-th microwave ( 1jB1 \le j \le B ) is sold at bjb_j yen.

You have MM discount tickets. With the ii-th ticket ( 1iM1 \le i \le M ), you can get a discount of cic_i yen from the total price when buying the xix_i-th refrigerator and the yiy_i-th microwave together. Only one ticket can be used at a time.

You are planning to buy one refrigerator and one microwave. Find the minimum amount of money required.

Constraints

  • All values in input are integers.
  • 1A1051 \le A \le 10^5
  • 1B1051 \le B \le 10^5
  • 1M1051 \le M \le 10^5
  • 1ai,bi,ci1051 \le a_i , b_i , c_i \le 10^5
  • 1xiA1 \le x_i \le A
  • 1yiB1 \le y_i \le B
  • ciaxi+byic_i \le a_{x_i} + b_{y_i}

Input

Input is given from Standard Input in the following format:

AA BB MM

a1a_1 a2a_2 ...... aAa_A

b1b_1 b2b_2 ...... bBb_B

x1x_1 y1y_1 c1c_1

\vdots

xMx_M yMy_M cMc_M

Output

Print the answer.

2 3 1
3 3
3 3 3
1 2 1
5

With the ticket, you can get the 11-st refrigerator and the 22-nd microwave for 3+31=53+3-1=5 yen.

1 1 2
10
10
1 1 5
1 1 10
10

Note that you cannot use more than one ticket at a time.

2 2 1
3 5
3 5
2 2 2
6

You can get the 11-st refrigerator and the 11-st microwave for 66 yen, which is the minimum amount to pay in this case. Note that using a ticket is optional.