#include <bits/stdc++.h>
using namespace std;
long long int seting(long long int N, int pos) { return N = N | (1 << pos); }
long long int reset(long long int N, int pos) { return N = N & ~(1 << pos); }
bool chek(long long int N, int pos) { return (bool)(N & (1 << pos)); }
long long int dp[18][(1 << 18) + 2], n;
long long int arr[20];
long long int w[20][20];
int m, k;
long long int solve(int pos, long long int mask) {
  int cnt, i;
  long long int tmp;
  cnt = __builtin_popcount(mask);
  if (cnt == m) return 0;
  long long int res = 0;
  if (pos != -1 and dp[pos][mask] != -1) return dp[pos][mask];
  for (i = 0; i < n; i++) {
    if (chek(mask, i) == 0) {
      tmp = mask;
      tmp = seting(mask, i);
      if (pos == -1) {
        res = max(res, arr[i] + solve(i, tmp));
      } else {
        res = max(res, arr[i] + w[i][pos] + solve(i, tmp));
      }
    }
  }
  if (pos != -1)
    return dp[pos][mask] = res;
  else
    return res;
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%d %d %d", &n, &m, &k);
  int i, u, v;
  long long int c;
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 1; i <= k; i++) {
    cin >> u >> v >> c;
    w[v - 1][u - 1] = c;
  }
  cout << solve(-1, 0) << endl;
  return 0;
}
