#include <bits/stdc++.h>
using namespace std;
long long dp[1 << 18][18], a[18];
bool inque[1 << 18][18];
long long edge[18][18];
queue<pair<int, int> > state;
int bit_count(int v) {
  int ans = 0;
  while (v) {
    ans++;
    v &= v - 1;
  }
  return ans;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < k; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    u--;
    v--;
    if (c > edge[u][v]) edge[u][v] = c;
  }
  for (int i = 0; i < n; i++) {
    dp[1 << i][i] = a[i];
    state.push(make_pair(1 << i, i));
    inque[1 << i][i] = true;
  }
  while (!state.empty()) {
    pair<int, int> front_state = state.front();
    state.pop();
    int state_bit = front_state.first;
    int u = front_state.second;
    inque[state_bit][u] = false;
    if (bit_count(state_bit) == m) continue;
    for (int v = 0; v < n; v++) {
      int v_state = (1 << v) | state_bit;
      if (state_bit == v_state) continue;
      if (dp[state_bit][u] + a[v] + edge[u][v] > dp[v_state][v]) {
        dp[v_state][v] = dp[state_bit][u] + a[v] + edge[u][v];
        if (!inque[v_state][v]) state.push(make_pair(v_state, v));
        inque[v_state][v] = true;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 1 << n; i++) {
    if (bit_count(i) != m) continue;
    for (int j = 0; j < n; j++) {
      if (dp[i][j] > ans) ans = dp[i][j];
    }
  }
  cout << ans << endl;
}
