#include <bits/stdc++.h>
using namespace std;
const long long mxn = 1e6 + 10;
const long long inf = 1e9;
const long long mod = 1e9 + 7;
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long n, m, k, a[mxn], dp[mxn][30], b[mxn], c[30][30];
long long mx = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  b[0] = 1;
  for (int i = 1; i <= n; i++) b[i] = b[i - 1] * 2;
  for (int i = 0; i < n; i++) {
    dp[b[i]][i] = a[i];
  }
  for (int i = 1; i <= k; i++) {
    long long x, y, z;
    cin >> x >> y >> z;
    c[x - 1][y - 1] = z;
  }
  for (long long 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] + c[i][j] + a[j]);
  }
  for (int i = 0; i <= b[n]; i++) {
    if (__builtin_popcount(i) == m) {
      for (int j = 0; j < n; j++) {
        if (mx < dp[i][j]) {
          mx = dp[i][j];
        }
      }
    }
  }
  cout << mx << endl;
  return 0;
}
