#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
long long a[20], dp[20][(1 << 18) + 50];
map<pair<long long, long long>, long long> mp;
long long Rec(long long i, long long Mask) {
  if (__builtin_popcount(Mask) == m) return 0;
  if (dp[i][Mask] != -1) return dp[i][Mask];
  long long Answer = 0;
  for (long long j = 0; j < n; j++) {
    if (!(Mask & (1 << j)))
      Answer =
          max(Answer, a[j] + ((i == 0 && Mask == 0) ? 0 : mp[make_pair(i, j)]) +
                          Rec(j, Mask | (1 << j)));
  }
  return dp[i][Mask] = Answer;
}
int main() {
  long long x, y, c;
  cin >> n >> m >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  while (k--) {
    cin >> x >> y >> c;
    x--;
    y--;
    mp[make_pair(x, y)] = c;
  }
  memset(dp, -1, sizeof(dp));
  cout << Rec(0, 0);
  return 0;
}
