#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
long long M[20][20];
long long A[20];
long long dp[1 << 18 + 1][20];
int n, m;
long long sol(long long mask, int x) {
  int tenho = __builtin_popcount(mask);
  if (tenho == m) return 0;
  if (dp[mask][x] != -1) return dp[mask][x];
  long long ans = 0;
  for (int y = 0; y < n; y++) {
    if ((mask & (1 << y)) == 0) {
      ans = max(ans, sol(mask | (1 << y), y) + A[y] + M[x][y]);
    }
  }
  return dp[mask][x] = ans;
}
int main() {
  int k;
  cin >> n >> m >> k;
  for (int i(0); i < (n); i++) cin >> A[i];
  memset(M, 0, sizeof M);
  int x, y;
  long long c;
  while (k--) {
    cin >> x >> y >> c;
    M[x - 1][y - 1] = c;
  }
  for (int i = 0; i < (1 << n); i++)
    for (int j = 0; j < n; j++) dp[i][j] = -1;
  long long ans = 0;
  for (int i(0); i < (n); i++) {
    ans = max(ans, sol(1 << i, i) + A[i]);
  }
  cout << ans << "\n";
  return 0;
}
