#include <bits/stdc++.h>
using namespace std;
long long b[20], a[20], n, m, k, i, aa, bb, cs, c[20][20], ans = 0, j, mask,
                                                           dp[1048571][20];
long long find(long long x) {
  long long t = 0;
  for (i = 0; i < n; i++)
    if (x & b[i]) t++;
  return t;
}
int main() {
  scanf("%lld", &n);
  scanf("%lld", &m);
  scanf("%lld", &k);
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (i = 0; i < k; i++)
    scanf("%lld", &aa), scanf("%lld", &bb), scanf("%lld", &cs),
        c[aa - 1][bb - 1] = cs;
  b[0] = 1;
  for (i = 1; i <= n; i++) b[i] = b[i - 1] * 2;
  for (i = 0; i < n; i++) dp[b[i]][i] = a[i];
  for (mask = 0; mask < b[n]; mask++)
    for (i = 0; i < n; i++)
      if (mask & b[i])
        for (j = 0; j < n; j++)
          if ((mask & b[j]) == 0)
            dp[(mask | b[j])][j] =
                max(dp[(mask | b[j])][j], dp[mask][i] + c[i][j] + a[j]);
  for (mask = 0; mask < b[n]; mask++)
    if (find(mask) == m)
      for (i = 0; i < n; i++) ans = max(ans, dp[mask][i]);
  printf("%lld\n", ans);
  return 0;
}
