#include <bits/stdc++.h>
using namespace std;
long long maxi(long long a, long long b) { return a > b ? a : b; }
long long dp[(1 << 18)][19];
long long a[20];
long long n, m, k;
map<pair<int, int>, int> mp;
long long solve(int mask, int prev) {
  if (__builtin_popcountll(mask) == m) return 0;
  if (dp[mask][prev] != -1) return dp[mask][prev];
  long long ret = 0;
  for (int i = 0; i < n; i++) {
    if (mask & (1 << i)) continue;
    ret = maxi(ret, a[i] + mp[{prev, i}] + solve(mask | (1 << i), i));
  }
  dp[mask][prev] = ret;
  return ret;
}
int main() {
  cin >> n >> m >> k;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i <= k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    mp[{a, b}] = c;
  }
  cout << solve(0, 18) << endl;
}
