#include <bits/stdc++.h>
using namespace std;
long long bc[(1 << 20) + 7], a[(1 << 20) + 7];
long long dp[(1 << 20) + 7][20], c[20][20], s[20];
long long co(long long n) {
  if (bc[n] != -1) return bc[n];
  return (n == 0) ? 0 : co(n & (n - 1)) + 1;
}
bool cmp(const long long &l, const long long &r) {
  if (bc[l] == bc[r]) return l < r;
  return bc[l] < bc[r];
}
int main() {
  memset(c, 0, sizeof(c));
  memset(dp, 0, sizeof(dp));
  for (long long i = (0); i < ((1 << 20) + 7); i++) {
    bc[i] = -1;
    a[i] = i;
  }
  for (long long i = (0); i < ((1 << 20) + 7); i++) bc[i] = co(i);
  long long n, m, Q;
  scanf("%lld %lld %lld", &n, &m, &Q);
  for (long long i = (1); i < (n + 1); i++) scanf("%lld", &s[i]);
  for (long long i = (0); i < (Q); i++) {
    long long p, q, r;
    scanf("%lld %lld %lld", &p, &q, &r);
    c[p][q] = r;
  }
  sort(a, a + (1 << n), cmp);
  long long ans = 0;
  for (long long i = 1; bc[a[i]] <= m; i++) {
    for (long long j = (0); j < (n); j++) {
      if ((a[i] & (1 << j))) {
        dp[a[i]][j] = s[j + 1];
        long long pre = a[i] ^ (a[i] & (1 << j));
        for (long long k = (0); k < (n); k++) {
          if ((pre & (1 << k))) {
            dp[a[i]][j] =
                max(dp[a[i]][j], dp[pre][k] + c[k + 1][j + 1] + s[j + 1]);
          }
        }
        if (bc[a[i]] == m) ans = max(dp[a[i]][j], ans);
      }
    }
  }
  printf("%lld\n", ans);
}
