#include <bits/stdc++.h>
using namespace std;
const int NC = (1 << 18) + 23;
const int N = 18 + 3;
int dsh[N];
int rls[N][N];
long long dp[NC][N];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) cin >> dsh[i];
  for (int i = 0; i < k; ++i) {
    int x, y, c;
    cin >> x >> y >> c;
    --x, --y;
    rls[x][y] = c;
  }
  for (int i = 0; i < n; ++i) dp[(1 << i)][i] = dsh[i];
  for (int i = 0; i < (1 << n); ++i) {
    if (__builtin_popcount(i) >= m) continue;
    for (int j = 0; j < n; ++j) {
      if (((1 << j) & i) == 0) continue;
      for (int p = 0; p < n; ++p) {
        if (p == j) continue;
        if (((1 << p) & i) != 0) continue;
        auto st = (i | (1 << p));
        dp[st][p] = max(dp[st][p], dp[i][j] + rls[j][p] + dsh[p]);
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < (1 << n); ++i)
    ans = max(ans, *max_element(dp[i], dp[i] + n));
  cout << ans << '\n';
}
