#include <bits/stdc++.h>
using namespace std;
const int maxN = 20, maxT = (1 << 18);
int n, m, k;
long long dp[maxT][maxN], a[maxN], adj[maxN][maxN], ans;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    dp[1 << i][i] = a[i];
  }
  for (int i = 1; i <= k; i++) {
    int x, y;
    long long c;
    cin >> x >> y >> c;
    x--;
    y--;
    adj[x][y] = c;
    dp[(1 << x) + (1 << y)][y] = c;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (i != j) dp[(1 << i) + (1 << j)][j] += a[i] + a[j];
  if (m == 1) {
    for (int i = 0; i < n; i++) ans = max(ans, a[i]);
    cout << ans << endl;
    return 0;
  }
  if (m == 2) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        if (i != j) ans = max(ans, dp[(1 << i) + (1 << j)][j]);
    cout << ans << endl;
    return 0;
  }
  for (int i = 0; i < (1 << n); i++) {
    int p = i, cnt = 0, e[maxN];
    for (int j = 0; j < n; j++, p /= 2)
      if (p % 2 == 1) e[cnt++] = j;
    if (cnt >= 3) {
      for (int j = 0; j < cnt; j++) {
        for (int l = 0; l < cnt; l++)
          if (l != j)
            dp[i][e[j]] = max(dp[i][e[j]], dp[i - (1 << e[j])][e[l]] + a[e[j]] +
                                               adj[e[l]][e[j]]);
        if (cnt == m) ans = max(ans, dp[i][e[j]]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
