#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long dp[300010][20];
long long c[20][20];
int second[20];
int n, m, k;
long long so(int t, int j, int last) {
  if (j == 0) return 0;
  if (dp[t][last] != -1) return dp[t][last];
  dp[t][last] = 0;
  for (int i = 0; i < n; ++i) {
    if ((t & (1 << i)) != 0)
      continue;
    else
      dp[t][last] =
          max(dp[t][last], second[i] + c[last][i] + so(t | (1 << i), j - 1, i));
  }
  return dp[t][last];
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) cin >> second[i];
  for (int i = 0; i < k; ++i) {
    int t, t1, t2;
    cin >> t >> t1 >> t2;
    --t;
    --t1;
    c[t][t1] = t2;
  }
  cout << so(0, m, n);
  return 0;
}
