#include <bits/stdc++.h>
using namespace std;
long long n, m, k, dp[1 << 18][21], sat[20][20], a[21], s, x, y, c, temp, i, j,
    l, ans;
int32_t main() {
  cin >> n >> m >> k;
  memset(sat, 0, sizeof(sat));
  memset(dp, 0, sizeof(dp));
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < k; i++) {
    cin >> x >> y >> c;
    sat[x - 1][y - 1] = c;
  }
  s = 1 << n;
  ans = 0;
  for (i = 0; i < n; i++) {
    l = 1 << i;
    dp[l][i] = a[i];
  }
  for (i = 0; i < s; i++) {
    for (j = 0; j < n; j++) {
      if (i & (1 << j)) {
        for (l = 0; l < n; l++) {
          if (!(i & (1 << l))) {
            dp[i | (1 << l)][l] =
                max(dp[i | (1 << l)][l], dp[i][j] + a[l] + sat[j][l]);
          }
        }
      }
    }
  }
  for (i = 0; i < s; i++) {
    c = 0, temp = i;
    while (temp != 0) {
      c += (temp & 1);
      temp = temp >> 1;
    }
    if (c == m) {
      for (j = 0; j < n; j++) ans = max(ans, dp[i][j]);
    }
  }
  cout << ans;
}
