#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <fstream>
#include <set>
#include <cmath>
using namespace std;
long long memo[1 << 18];
int n,m,k;
map<int,pair<int,long long>> mp;
int a[20];
long long dp(int mask){
    if(__builtin_popcount(mask) == m){
        return 0;
    }
    if(memo[mask] != -1){
//        return memo[mask];
    }
    long long res =0;
    for (int i = 0; i < n; i++) {
        if(mask & (1 << i)){
            continue;
        }
        else{
            int temp_mask = (mask | (1 << i));
            pair<int,int> pir = mp[i];
            if(mask & (1 << pir.first)){
                res= max(res,dp(temp_mask) + pir.second + a[i]);
            }
            else{
                res= max(res,dp(temp_mask) + a[i]);
            }
        }

    }
    return memo[mask] = res;
}
int main(){
    cin >> n >> m >> k;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < k; i++) {
        int x,y,z;
        cin >> x >> y >> z;
        x--;
        y--;
        mp[y] = make_pair(x,z);
    }

    memset(memo,-1,sizeof memo);
    cout << dp(0);
}
