#include <bits/stdc++.h>
const double eps = 1e-7, PI = 3.1415926;
const int N = 19;
using namespace std;
long long n, q, m, k, x, y, a[N], mx = -1, mn = 1e9, sum, mem[(1 << 18)][19];
map<pair<int, int>, long long> mp;
bool on(int msk, int i) { return (msk & (1 << i)); }
long long dp(int msk, int prev) {
  if (__builtin_popcount(msk) == m) return 0;
  if (mem[msk][prev] != -1) return mem[msk][prev];
  long long ret = 0;
  for (int i = 0; i < n; i++) {
    if (!on(msk, i)) {
      ret = max(ret, a[i] + mp[{i, prev}] + dp(msk | (1 << i), i));
    }
  }
  return mem[msk][prev] = ret;
}
int main() {
  memset(mem, -1, sizeof mem);
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (q--) {
    cin >> x >> y >> k;
    x--, y--;
    mp[{y, x}] = k;
  }
  cout << dp(0, 18);
  return 0;
}
