#include <bits/stdc++.h>
using namespace std;
long long bit(long long p) { return (1 << p); }
long long dist[20][20], dp[20][1000005], a[20], n, m, k;
long long solve(long long u, long long bitmask) {
  if (__builtin_popcount(bitmask) == k) return 0;
  if (dp[u][bitmask] != -1) return dp[u][bitmask];
  long long res = 0;
  for (long long i = 0; i < n; i++)
    if (!(bitmask & bit(i)))
      res = max(res, solve(i, bitmask | bit(i)) + a[i] + dist[u][i]);
  return dp[u][bitmask] = res;
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> n >> k >> m;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) {
    long long u, v, w;
    cin >> u >> v >> w;
    u--;
    v--;
    dist[u][v] = w;
  }
  long long res = 0;
  for (long long i = 0; i < n; i++) res = max(res, solve(i, bit(i)) + a[i]);
  cout << res << endl;
  return 0;
}
