Battle of Poilogtopia
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 51 M,其他语言102 M
64bit IO Format: %lld

题目描述

Poilog who got a 4.0 grade in mathematical analysis, invented a game called Poilogtopia. Today he invites his friend Vltava, a master in game theory, to play Poilogtopia with him.


There are  castles on the map of Poilogtopia, the  of which has gained  coins. The castles are initially connected with  undirected weighted roads, the  of which connects castle  with weight . At the beginning of the game, Poilog is given  additional roads, in which he can choose the first  roads to construct. Constructing the  road would cost Poilog  coins, which must be taken into account.


After Poilog determines the map, Vltava can choose a set of castles as his territory and take over the coin accounts of these castles. Yet for all the roads which connect one castle inside Vltava's territory and the other castle outside, Poilog can collect w_i coins as toll fees. Both players' final scores equals to the coins they own at last, and both would like to maximize the value of his own score minus his opponent's score.

Simply putting, if Poilog chooses the first k roads and then Vltava chooses a castle set S as his territory,
    Vltava's score 

    Poilog's score 

Vltava would like to maximize Score_v-Score_p, while Poilog would like to minimize Score_v-Score_p.

Smart as Vltava and Poilog are, they would both choose the optimal strategy. As you are a huge fan of the two experts, please compute the final result Score_v-Score_p.


输入描述:

The first line contains three integers N,M,K.

The second line contains N integers a_1,a_2,...a_N
The third line contains K integers b_1,b_2,...b_K

The next  lines each contain three integers x,y,w, each describing a weighted road. Notice that the first M roads are initially placed on the map, and the following K roads are additional roads which Poilog would choose to add with certain costs.

It is guaranteed that for all  roads, no two roads connect the same set of castles.

Note that the castles do not have to be connected.

输出描述:

Output one single integer indicating Score_v-Score_p
示例1

输入

复制
4 5 1
-9 3 5 -1
1
1 2 2 
2 4 5
2 3 6
1 4 1
3 4 8
1 3 10

输出

复制
1

说明

If Poilog chooses not to add any road, Vltava would choose castle 2,3,4, and Score_v-Score_p=4.

If Poilog chooses to add the first road, the best choice for Vltava is to give up all the castles, and thus Score_v-Score_p=1.