#include <bits/stdc++.h>
using namespace std;
long long dp[1 << 20][20];
int edges[20][20];
int happiness[20];
int main(void) {
  int m, n, k;
  scanf("%d %d %d", &m, &n, &k);
  for (int i = 1; i <= m; i++) scanf("%d", &happiness[i]);
  for (int i = 0; i < k; i++) {
    int b, a, c;
    scanf("%d %d %d", &b, &a, &c);
    edges[b][a] = c;
  }
  for (int i = 1; i <= m; i++) dp[1 << (i - 1)][i] = happiness[i];
  int range = 1 << m;
  for (int i = 1; i < range; i++) {
    for (int j = 1; j <= m; j++) {
      if ((i & (1 << (j - 1)))) {
        for (int k = 1; k <= m; k++) {
          if (i & (1 << (k - 1))) continue;
          dp[i + (1 << (k - 1))][k] =
              (((dp[i + (1 << (k - 1))][k]) >
                (dp[i][j] + happiness[k] + edges[j][k]))
                   ? (dp[i + (1 << (k - 1))][k])
                   : (dp[i][j] + happiness[k] + edges[j][k]));
        }
      }
    }
  }
  long long max = 0;
  for (int i = 1; i < range; i++) {
    for (int j = 1; j <= m; j++) {
      int bit_num = 0;
      int temp = 1;
      while (temp <= range) {
        if (temp & i) bit_num++;
        temp <<= 1;
      }
      if (bit_num == n && max < dp[i][j]) max = dp[i][j];
    }
  }
  printf("%lld\n", max);
  return 0;
}
