#include <bits/stdc++.h>
using namespace std;
int const oo = 1e9, bound = 1e6, mod = oo + 7;
long long const OO = 1e18;
int n, m, k, aa[20];
int cc[20][20];
long long dp[18][1 << 18];
long long rec(int idx, int msk) {
  long long &ret = dp[idx][msk];
  if (ret != -1) return ret;
  int cop = msk, e = 0;
  while (cop) {
    if (cop & 1) e++;
    cop >>= 1;
  }
  if (e == m) return ret = 0;
  for (int(i) = 0; (i) < (n); (i)++) {
    if (!((msk >> i) & 1))
      ret = max(ret,
                rec(i, (1 << i) | msk) + aa[i] + (msk != 0 ? cc[idx][i] : 0));
  }
  return ret;
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%d", &n), scanf("%d", &m), scanf("%d", &k);
  for (int(i) = 0; (i) < (n); (i)++) scanf("%d", &aa[i]);
  for (int(i) = 0; (i) < (k); (i)++) {
    int a, b, c;
    scanf("%d", &a), scanf("%d", &b), scanf("%d", &c);
    a--, b--;
    cc[a][b] = c;
  }
  long long mx = rec(0, 0);
  printf("%lld\n", mx);
  return 0;
}
