#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1 << 18;
long long N, M, K, a[20], w[20][20], f[maxn][20];
int main() {
  scanf("%I64d%I64d%I64d", &N, &M, &K);
  for (long long i = 1; i <= N; i++) scanf("%I64d", &a[i]);
  for (long long i = 1; i <= K; i++) {
    long long x, y, c;
    scanf("%I64d%I64d%I64d", &x, &y, &c);
    w[x][y] = c;
  }
  long long ans = 0;
  for (long long i = 0; i < N; i++) f[1 << i][i + 1] = a[i + 1];
  for (long long i = 0; i < (1 << N); i++) {
    long long cnt = 0;
    for (long long j = 0; j < N; j++) {
      if (i & (1 << j)) {
        cnt++;
        for (int k = 0; k < N; k++) {
          if (!(i & (1 << k)))
            f[i | (1 << k)][k + 1] =
                max(f[i | (1 << k)][k + 1],
                    f[i][j + 1] + a[k + 1] + w[j + 1][k + 1]);
        }
      }
    }
    if (cnt == M) {
      for (long long j = 0; j < N; j++)
        if (i & (1 << j)) ans = max(ans, f[i][j + 1]);
    }
  }
  printf("%I64d", ans);
  return 0;
}
