#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
inline void chmax(int& x, int y) {
  if (x < y) x = y;
}
inline void chmin(int& x, int y) {
  if (x > y) x = y;
}
inline int LSB(int i) { return (i & -i); }
int n, m, k;
long long dp[(1 << 18) + 5][20], sat[20], rule[20][20], res;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> sat[i];
  for (int i = 0, a, b, c; i < k; i++) {
    cin >> a >> b >> c;
    rule[--a][--b] = c;
  }
  for (int i = 0; i < n; i++) dp[(1 << i)][i] = sat[i];
  for (int i = 0; i < (1 << n); i++) {
    if (__builtin_popcount(i) == m) {
      res = max(res, *max_element(dp[i], dp[i] + n));
    }
    if (__builtin_popcount(i) > m - 1) continue;
    for (int j = 0; j < n; j++) {
      if (!(i & (1 << j))) {
        for (int k = 0; k < n; k++) {
          if (i & (1 << k)) {
            dp[i | (1 << j)][j] =
                max(dp[i | (1 << j)][j], dp[i][k] + sat[j] + rule[k][j]);
          }
        }
      }
    }
  }
  cout << res << endl;
  return 0;
}
