#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> satis(20);
int add[18][18];
long long dp[1 << 18][18];
long long solve(int msk, int last) {
  if (__builtin_popcount(msk) == m) return 0;
  long long &r = dp[msk][last];
  if (r != -1) return r;
  r = 0;
  for (int i = 0; i < n; i++) {
    if (msk & (1 << i)) continue;
    r = max(r, solve(msk | (1 << i), i) + add[last][i] + satis[i]);
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> satis[i];
  }
  memset(&add, 0, sizeof(add));
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    add[--a][--b] = c;
  }
  memset(dp, -1, sizeof(dp));
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, solve((1 << i), i) + satis[i]);
  }
  cout << ans << "\n";
  ;
  return 0;
}
