#include <bits/stdc++.h>
using namespace std;
long long n, m, k, mask, ans;
long long a[19];
long long b[19];
long long dp[1228228][19];
long long cost[19][19];
long long len(long long mask) {
  int cnt = 0;
  for (int i = 0; i < n; ++i)
    if ((mask & b[i])) ++cnt;
  return cnt;
}
int main() {
  cin >> n >> m >> k;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  b[0] = 1;
  for (long long i = 1; i <= n; ++i) b[i] = b[i - 1] * 2;
  for (long long i = 0; i < k; ++i) {
    long long x, y, z;
    cin >> x >> y >> z;
    cost[x - 1][y - 1] = z;
  }
  for (long long i = 0; i < n; ++i) dp[b[i]][i] = a[i];
  for (mask = 0; mask < b[n]; ++mask)
    for (long long i = 0; i < n; ++i)
      if ((mask & b[i]))
        for (long long j = 0; j < n; ++j)
          if (!(mask & b[j]))
            dp[(mask | b[j])][j] =
                max(dp[(mask | b[j])][j], dp[mask][i] + cost[i][j] + a[j]);
  for (mask = 0; mask < b[n]; ++mask)
    if (len(mask) == m)
      for (long long i = 0; i < n; ++i) ans = max(ans, dp[mask][i]);
  cout << ans;
  return 0;
}
