#include <bits/stdc++.h>
using namespace std;
void solve(vector<vector<int>>& adjMatrix, vector<long long int>& satisfaction,
           int n, int m, int k) {
  vector<vector<long long int>> dp((1 << n), vector<long long int>(n, 0));
  for (int i = 0; i < n; i++) {
    dp[(1 << i)][i] = satisfaction[i];
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int i = 0; i < n; i++) {
      if (!(mask & (1 << i))) continue;
      for (int j = 0; j < n; j++) {
        if (mask & (1 << j)) continue;
        dp[mask | (1 << j)][j] =
            max(dp[mask | (1 << j)][j],
                dp[mask][i] + adjMatrix[i][j] + satisfaction[j]);
      }
    }
  }
  long long int ans = 0;
  for (int mask = 0; mask < (1 << n); mask++) {
    if (__builtin_popcount(mask) == m) {
      for (int i = 0; i < n; i++) {
        ans = max(ans, dp[mask][i]);
      }
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector<long long int> satisfaction(n);
    for (int i = 0; i < n; i++) {
      cin >> satisfaction[i];
    }
    vector<vector<int>> adjMatrix(n, vector<int>(n, 0));
    for (int i = 0; i < k; i++) {
      int u, v, w;
      cin >> u >> v >> w;
      u--;
      v--;
      adjMatrix[u][v] = w;
    }
    solve(adjMatrix, satisfaction, n, m, k);
  }
}
