#include <bits/stdc++.h>
using namespace std;
vector<long long> b(20, -1), c(20, 0), cal(20, 0), pp(20, 0);
vector<vector<long long> > dp(563000, b), rule(20, c);
long long n, m, k;
void init() {
  cin >> n >> m >> k;
  long long i, j;
  for (i = 0; i < n; i++) cin >> cal[i];
  for (i = 0; i < k; i++) {
    long long q, w, e;
    cin >> q >> w >> e;
    rule[q - 1][w - 1] = e;
  }
  pp[0] = 1;
  for (i = 1; i <= 18; i++) pp[i] = pp[i - 1] * 2;
}
long long sz = 5000000;
vector<pair<long long, long long> > qu(sz);
vector<long long> numb(sz);
long long qs, qf;
int main() {
  init();
  qs = 1;
  qf = 1;
  long long i, j;
  long long ans = 0;
  for (i = 0; i < n; i++) {
    dp[pp[i]][i] = cal[i];
    ans = max(ans, cal[i]);
    qu[qf] = make_pair(pp[i], i);
    numb[qf] = 1;
    qf++;
  }
  if (m == 1) {
    long long cur = -1;
    for (i = 0; i < n; i++) cur = max(cur, cal[i]);
    cout << cur;
    return 0;
  }
  while (qs < qf) {
    long long mask = qu[qs].first;
    long long last = qu[qs].second;
    if (numb[qs] == m) ans = max(ans, dp[mask][last]);
    long long temp = mask;
    for (i = 0; i < n; i++) {
      if (temp % 2 == 0) {
        long long nextVal = mask + pp[i];
        long long nextLast = i;
        if (dp[nextVal][nextLast] == -1) {
          qu[qf] = make_pair(nextVal, nextLast);
          numb[qf] = numb[qs] + 1;
          qf++;
        }
        dp[nextVal][nextLast] =
            max(dp[nextVal][nextLast],
                dp[mask][last] + cal[i] + rule[last][nextLast]);
      }
      temp /= 2;
    }
    qs++;
  }
  cout << ans;
  return 0;
}
