#include <bits/stdc++.h>
using namespace std;
int n, m;
int A[18];
int D[18][18];
long long dp[18][1 << 18];
long long f(int i, int j) {
  if (__builtin_popcount(j) == m) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  long long mx = 0;
  for (int k = 0; k < n; ++k)
    if (!((1 << k) & j)) mx = max(mx, A[k] + D[i][k] + f(k, j | (1 << k)));
  return dp[i][j] = mx;
}
int main() {
  int k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) cin >> A[i];
  int u, v;
  while (k--) {
    cin >> u >> v;
    cin >> D[u - 1][v - 1];
  }
  if (m == 0)
    cout << 0;
  else {
    memset(dp, -1, sizeof dp);
    long long mx = 0;
    for (int i = 0; i < n; ++i) mx = max(mx, A[i] + f(i, 1 << i));
    cout << mx;
  }
  return 0;
}
