#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 18;
int n, m, K;
int value[MAX_N], add[MAX_N][MAX_N];
long long dp[1 << MAX_N][MAX_N];
void wyr() {
  memset(dp, 0, sizeof(dp));
  long long ans = 0;
  for (int s = 1; s < (1 << n); ++s) {
    int num = __builtin_popcount(s);
    for (int i = 0; i < n; ++i) {
      if ((s & (1 << i)) == 0) continue;
      int ss = s - (1 << i);
      if (ss == 0) {
        dp[s][i] = value[i];
        ans = max(ans, dp[s][i]);
        continue;
      }
      for (int j = 0; j < n; ++j) {
        if ((ss & (1 << j)) == 0) continue;
        dp[s][i] = max(dp[s][i], dp[ss][j] + add[j][i] + value[i]);
      }
      if (num == m) {
        ans = max(ans, dp[s][i]);
      }
    }
  }
  printf("%lld\n", ans);
}
int main() {
  while (~scanf("%d%d%d", &n, &m, &K)) {
    for (int i = 0; i < n; ++i) {
      scanf("%d", &value[i]);
    }
    memset(add, 0, sizeof(add));
    for (int i = 0; i < K; ++i) {
      int u, v, w;
      scanf("%d%d%d", &u, &v, &w);
      u--, v--;
      add[u][v] = w;
    }
    wyr();
  }
  return 0;
}
