#include <bits/stdc++.h>
using namespace std;
const int M = 262150;
int v[20], s[20][20];
long long dp[M][20];
int main() {
  int n, m, k, x, y, z;
  long long ans = 0;
  scanf("%d%d%d", &n, &m, &k);
  memset(s, 0, sizeof(s));
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  for (int i = 0; i < k; i++) {
    scanf("%d%d%d", &x, &y, &z);
    s[x - 1][y - 1] = z;
  }
  for (int i = 0; i < n; i++) dp[1 << i][i] = v[i];
  int cnt = 1 << n;
  for (int l = 0; l < cnt; l++) {
    int cntt = 0;
    for (int i = 0; i < n; i++) {
      if ((l & (1 << i)) == 0) continue;
      cntt++;
      for (int j = 0; j < n; j++) {
        if (l & (1 << j)) continue;
        int ne = l | (1 << j);
        dp[ne][j] = max(dp[ne][j], dp[l][i] + v[j] + s[i][j]);
      }
    }
    if (cntt == m) {
      for (int i = 0; i < n; i++) {
        if (l & (1 << i)) ans = max(ans, dp[l][i]);
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
