#include <bits/stdc++.h>
using namespace std;
const int N = 20;
long long n, m, k, a[N], c[N][N];
long long mem[1 << N][N];
long long dp(int msk, int last) {
  if (__builtin_popcount(msk) == m) return 0;
  long long &ret = mem[msk][last];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = 1; i <= n; i++) {
    if (!(msk & (1LL << (i - 1)))) {
      if (msk != 0)
        ret = max(ret, 1LL * dp(msk | (1LL << (i - 1)), i) + a[i] + c[last][i]);
      else
        ret = max(ret, 1LL * dp(msk | (1LL << (i - 1)), i) + a[i]);
    }
  }
  return max(ret, 0LL);
}
int main() {
  memset(mem, -1, sizeof mem);
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < k; i++) {
    int a, b, Tony;
    scanf("%d%d%d", &a, &b, &Tony);
    c[a][b] = Tony;
  }
  printf("%lld", dp(0, 0));
}
