#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-9;
int n, m, k;
int st[20], add[20][20];
long long dp[(1 << 18) + 5][20];
int main() {
  std::ios::sync_with_stdio(0);
  cin >> n >> m >> k;
  for (int i = 0; i <= n - 1; ++i) cin >> st[i];
  for (int i = 1, x, y, z; i <= k; ++i) {
    cin >> x >> y >> z;
    add[x - 1][y - 1] = z;
  }
  for (int i = 0; i <= n - 1; ++i) dp[(1 << i)][i] = st[i];
  long long ans = 0, tot = (1 << 18);
  for (int s = 0; s < tot; ++s) {
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
      if (s & (1 << i)) {
        cnt++;
        for (int j = 0; j < n; ++j) {
          if ((s & (1 << j)) == 0) {
            int ns = s | (1 << j);
            dp[ns][j] = max(dp[ns][j], dp[s][i] + st[j] + add[i][j]);
          }
        }
      }
    }
    if (cnt == m) {
      for (int j = 0; j <= n - 1; ++j) ans = max(ans, dp[s][j]);
    }
  }
  cout << ans << endl;
  return 0;
}
