#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, m, k;
long long c[20][20], a[N], dp[1 << 20][20];
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= k; i++) {
    int x, y, w;
    cin >> x >> y >> w;
    c[x][y] = w;
  }
  int num = (1 << n) - 1;
  long long res = 0;
  memset(dp, -1, sizeof dp);
  for (int i = 1; i <= n; i++) {
    dp[(1 << (i - 1))][i] = a[i];
  }
  for (int i = 0; i <= num; i++) {
    for (int j = 1; j <= n; j++) {
      if (i & (1 << (j - 1))) {
        for (int p = 1; p <= n; p++) {
          if (p == j) continue;
          if (i & (1 << (p - 1))) continue;
          dp[i + (1 << (p - 1))][p] =
              max(dp[i + (1 << (p - 1))][p], dp[i][j] + a[p] + c[j][p]);
        }
      }
      if (__builtin_popcount(i) == m) {
        res = max(res, dp[i][j]);
      }
    }
  }
  cout << res << endl;
  return 0;
}
