#include <bits/stdc++.h>
using namespace std;
long long arr[20], s[20][20], dp[1 << 19][20];
int main() {
  memset(s, 0, sizeof(s));
  memset(dp, 0, sizeof(dp));
  long long i, j, k, n, m, tmp, loc, glo = 0, x, y, z;
  cin >> n >> m >> k;
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < k; i++) {
    cin >> x >> y >> z;
    s[x - 1][y - 1] = z;
  }
  for (i = 0; i < n; i++) dp[1 << i][i] = arr[i];
  for (i = 0; i < (1 << n); i++) {
    for (j = 0; j < n; j++) {
      if (i & 1 << j) {
        for (k = 0; k < n; k++) {
          if ((i & 1 << k) == 0) {
            dp[i | (1 << k)][k] =
                max(dp[i | (1 << k)][k], dp[i][j] + s[j][k] + arr[k]);
          }
        }
      }
    }
  }
  for (i = 0; i < (1 << n); i++) {
    for (j = 0; j < n; j++) {
      if (__builtin_popcount(i) == m) glo = max(glo, dp[i][j]);
    }
  }
  cout << glo << endl;
  return 0;
}
