P19546 [HackerEarth] Dr. Wells decided to speed up flash. He gave flash N powers to chose from. But flash knows he requires exactly M powers. Each power i has got an intensity level Ai associated with it. T
提高-
题目描述

Dr. Wells decided to speed up flash. He gave flash N powers to chose from. But flash knows he requires exactly M powers. Each power i has got an intensity level Ai associated with it. There are K rules defined for taking powers : If he take power x exactly before y , his intensity level raises by c units.

Help Flash to maximize his intensity level.

First line contains 3 integers N,M and K which are already defined above.
Second line contains N integers A1,A2,....,AN denoting intensity level of each power.
Next K lines contains rules. Rach rule contains 3 integers x,y and c.

Output the maximum intensity level Flash can reach.

SAMPLE INPUT
2 2 1
1 1
2 1 1

SAMPLE OUTPUT
3

Explanation

It is good to first have the second power, then the first one. Then we get one unit of intensity for each power and one more as per the rule.

输入格式

见题面

输出格式

见题面

样例输入
18 2 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 18 2 5 7 8 3 1 18 2 6 4 1
样例输出
516