#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long mat[18][18], dp[1 << 18][18], arr[18];
int main(void) {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < k; i++) {
    int a, b;
    long long c;
    cin >> a >> b >> c;
    mat[a - 1][b - 1] = c;
  }
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < n; i++) {
    dp[(1 << i)][i] = arr[i];
  }
  long long ans = 0;
  for (int i = 1; i < (1 << n); i++) {
    vector<int> poss, nposs;
    for (int j = 0; j < n; j++) {
      if (i & (1 << j))
        poss.push_back(j);
      else
        nposs.push_back(j);
    }
    if (poss.size() == m) {
      for (int j : poss) ans = max(dp[i][j], ans);
    } else if (poss.size() < m) {
      for (int j : nposs) {
        for (int m : poss) {
          dp[i + (1 << j)][j] =
              max(dp[i + (1 << j)][j], dp[i][m] + mat[m][j] + arr[j]);
        }
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
