#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1 << 19;
const int Inf = 1 << 30;
int n, m, k, u, v, Ma;
long long tu[20][20], w, dp[MaxN + 5][20], a[20], ans;
bool check(int x) {
  int flag = 0, cnt = 0;
  while (x) {
    if (x & 1) cnt++;
    x >>= 1;
    if (cnt > m) {
      flag = 1;
      break;
    }
  }
  return flag;
}
int main() {
  while (~scanf("%d %d %d", &n, &m, &k)) {
    memset(dp, 0, sizeof(dp));
    memset(tu, 0, sizeof(tu));
    Ma = 0;
    ans = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      dp[1 << (i - 1)][i] = a[i];
      if (m >= 1) ans = max(a[i], ans);
      Ma += 1 << (i - 1);
    }
    for (int i = 1; i <= k; i++) {
      scanf("%d %d %I64d", &u, &v, &w);
      tu[u][v] = w;
    }
    for (int i = 1; i <= Ma; i++) {
      if (check(i)) continue;
      for (int j = 1; j <= n; j++) {
        if ((i & (1 << (j - 1))) == 0) continue;
        for (int k = 1; k <= n; k++) {
          if (k == j || (i & (1 << (k - 1))) == 0) continue;
          dp[i][j] = max(dp[i ^ (1 << (j - 1))][k] + tu[k][j] + a[j], dp[i][j]);
          ans = max(dp[i][j], ans);
        }
      }
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
