#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, long long> mp;
long long n, m, k, a[20], mem[1 << 18][25];
long long dp(int msk, int last) {
  if (__builtin_popcount(msk) == m) return 0;
  long long &ret = mem[msk][last];
  if (ret != -1) return ret;
  long long i = 0, x1 = 0;
  for (i = 0; i < n; i++) {
    if (!(msk & (1 << i)))
      x1 = max(x1, dp(msk | (1 << i), i) + a[i] + mp[{last, i}]);
  }
  return ret = x1;
}
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 >> a[i];
  long long x, y, c;
  while (k--) {
    cin >> x >> y >> c;
    mp[{x - 1, y - 1}] = c;
  }
  memset(mem, -1, sizeof mem);
  x = 0;
  for (int i = 0; i < n; i++) x = max(x, dp(1 << i, i) + a[i]);
  cout << x;
}
