#include <bits/stdc++.h>
using namespace std;
const int N = 19;
int a[N], c[N][N];
long long dp[1 << N][N];
int n, m, k;
long long solve(int mask, int i) {
  if (__builtin_popcount(mask) == m) return 0;
  long long &ret = dp[mask][i];
  if (ret != -1) return ret;
  ret = 0;
  for (int j = 0; j < n; ++j) {
    if ((mask >> j) & 1) continue;
    ret = max(ret, solve(mask | (1 << j), j) + a[j] + c[i][j]);
  }
  return ret;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  for (int i = 0; i < k; ++i) {
    int x, y, ci;
    scanf("%d %d %d", &x, &y, &ci);
    c[x - 1][y - 1] = ci;
  }
  memset(dp, -1, sizeof dp);
  printf("%I64d\n", solve(0, n));
}
