#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
long long a[19];
long long dp[1 << 19][19];
long long c[19][19];
long long f(long long x, long long y) {
  long long temp = 0;
  for (long long i = 0; i < n; i++) {
    if (x & (1 << i)) temp++;
  }
  if (temp == m) return 0;
  if (dp[x][y] != -1)
    return dp[x][y];
  else {
    long long ans = -1e18;
    for (long long i = 0; i < n; i++) {
      if ((x & (1 << i)) == 0) {
        if (x != 0)
          ans = max(ans, c[y][i] + a[i] + f((x | (1 << i)), i));
        else
          ans = max(ans, f(x | (1 << i), i) + a[i]);
      }
    }
    return dp[x][y] = ans;
  }
}
int32_t main() {
  cin >> n >> m >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  memset(c, 0, sizeof(c));
  for (long long i = 0; i < k; i++) {
    long long x, y, c1;
    cin >> x >> y >> c1;
    c[x - 1][y - 1] = c1;
  }
  memset(dp, -1, sizeof(dp));
  cout << f(0, 0);
}
