#include <bits/stdc++.h>
using namespace std;
const long long mx = 19;
const long long mx1 = 262150;
long long s[mx];
long long n, m, k;
long long extra[mx][mx];
long long dp[mx][mx1];
long long solve(long long prev, long long bitmask, long long m) {
  if (m == 0) return 0;
  if (dp[prev][bitmask] != -1) return dp[prev][bitmask];
  long long ans = INT_MIN;
  for (long long j = 0; j < mx; j++) {
    if (bitmask & (1 << j))
      ans = max(ans, extra[prev][j + 1] + s[j + 1] +
                         solve(j + 1, bitmask ^ (1 << j), m - 1));
  }
  return dp[prev][bitmask] = ans;
}
signed main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) cin >> s[i];
  long long a, b, c;
  memset(extra, 0, sizeof(extra));
  for (long long i = 0; i < k; i++) {
    cin >> a >> b >> c;
    extra[a][b] = c;
  }
  long long bitmask = (1 << n) - 1;
  long long prev = 0;
  memset(dp, -1, sizeof(dp));
  cout << solve(prev, bitmask, m) << "\n";
  return 0;
}
