#include <bits/stdc++.h>
using namespace std;
long long v[55][55];
long long dp[1 << 19][19];
long long p[555];
int main(void) {
  int n, m, kk;
  cin >> n >> kk >> m;
  for (int i = 1; i <= n; ++i) cin >> p[i];
  long long first, second, z, k = 1 << n;
  while (m--) {
    cin >> first >> second >> z;
    --first;
    --second;
    v[first][second] = z;
  }
  for (int i = 0; i < n; ++i) dp[1 << i][i] = p[i + 1];
  long long ans = 0;
  for (int i = 0; i < (1 << n); ++i) {
    int cnt = 0;
    for (int j = 0; j < n; ++j) cnt += (i >> j) & 1;
    if (cnt == kk)
      for (int j = 0; j < n; ++j) ans = max(ans, dp[i][j]);
    for (int j = 0; j < n; ++j)
      if ((i >> j) & 1)
        for (int l = 0; l < n; ++l)
          if (!((i >> l) & 1))
            dp[i | (1 << l)][l] =
                max(dp[i | (1 << l)][l], dp[i][j] + p[l + 1] + v[j][l]);
  }
  return cout << ans << '\n', 0;
}
