#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long cl(long double a) {
  if (a > (long long)a) {
    return (long long)a + 1;
  } else {
    return (long long)a;
  }
}
long long flr(long double a) { return (long long)a; }
long long n, m, k, x, y, z;
const long long M = 20;
long long arr[M];
const long long mx = (1 << 19) + 1;
long long dp[mx][M];
long long ext[M][M] = {0};
long long cnt(long long num) {
  long long ans = 0;
  while (num > 0) {
    if (num & 1) ans++;
    num = num >> 1;
  }
  return ans;
}
long long recur(long long mask, long long prev) {
  if (cnt(mask) == m) return 0;
  if (dp[mask][prev] != -1) return dp[mask][prev];
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (((1 << i) & mask) == 0) {
      ans = max(ans, arr[i] + ext[i][prev] + recur((mask | (1 << i)), i));
    }
  }
  dp[mask][prev] = ans;
  return ans;
}
void solve() {
  cin >> n;
  cin >> m;
  cin >> k;
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  memset(dp, -1, sizeof(dp));
  for (long long i = 0; i < k; i++) {
    cin >> x;
    cin >> y;
    cin >> z;
    ext[x][y] = z;
  }
  cout << recur(0, 0) << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) solve();
}
