#include <bits/stdc++.h>
using namespace std;
int a[18];
static int c[18][18];
int64_t dp[18][262144];
void dp_calc(int v, int n, int m, unsigned int mask) {
  if (m == 1) {
    dp[v][mask] = a[v];
    return;
  }
  if (dp[v][mask] != -1) return;
  dp[v][mask] = 0;
  for (int i = 0; i < n; i++)
    if (((1 << i) & mask) && i != v) {
      int next_mask = mask - (1 << v);
      dp_calc(i, n, m - 1, next_mask);
      if (dp[i][next_mask] + c[i][v] > dp[v][mask])
        dp[v][mask] = dp[i][next_mask] + c[i][v];
    }
  dp[v][mask] += a[v];
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  unsigned int mask = 0;
  for (int i = 0; i < n; i++) mask |= 1 << i;
  for (int i = 0; i < n; i++)
    for (unsigned int k = 0; k <= mask; k++) dp[i][k] = -1;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < k; i++) {
    int xi, yi, ci;
    cin >> xi >> yi >> ci;
    c[xi - 1][yi - 1] = ci;
  }
  int64_t max = 0;
  for (int i = 0; i < n; i++) {
    dp_calc(i, n, m, mask);
    if (dp[i][mask] > max) max = dp[i][mask];
  }
  cout << max << endl;
  return 0;
}
