#include <bits/stdc++.h>
const int z = 18;
const double eps = 1e-9;
const int inf = int(1e9);
const long long llinf = int(1e18);
using namespace std;
long long n, m, k, cost[z], v, u, w, e[z][z], dp[1 << z][z], ans;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> cost[i];
  for (int i = 0; i < k; i++) {
    cin >> v >> u >> w;
    v--;
    u--;
    e[v][u] = w;
  }
  for (int mask = 0; mask < (1 << n); mask++)
    for (int last = 0; last < n; last++) dp[mask][last] = -llinf;
  for (int i = 0; i < n; i++) dp[1 << i][i] = cost[i];
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int last = 0; last < n; last++)
      for (int to = 0; to < n; to++) {
        if (mask & (1 << to)) continue;
        dp[mask | (1 << to)][to] = max(dp[mask | (1 << to)][to],
                                       dp[mask][last] + e[last][to] + cost[to]);
      }
  }
  for (int mask = 0; mask < (1 << n); mask++)
    if (__builtin_popcount(mask) == m)
      for (int last = 0; last < n; last++) ans = max(ans, dp[mask][last]);
  cout << ans;
  return 0;
}
