#include <bits/stdc++.h>
using namespace std;
int v[20][20], m, n;
int a[20];
long long dp[(1 << 18) + 5][20];
int setbit(int N, int pos) { return N = N | (1 << pos); }
bool checkbit(int N, int pos) { return (bool)(N & (1 << pos)); }
int resetbit(int N, int pos) { return N = N & ~(1 << pos); }
long long solve(int mask, int nici, int age) {
  if (nici == m) return 0;
  if (dp[mask][age] != -1) return dp[mask][age];
  long long ans = 0;
  for (int i = 0; i <= n - 1; i++) {
    if (!checkbit(mask, i)) {
      ans = max(ans, 1ll * solve(setbit(mask, i), nici + 1, i) + 1ll * a[i] +
                         1ll * ((age == 19) ? 0 : v[age][i]));
    }
  }
  return dp[mask][age] = ans;
}
int main() {
  int k, u, vv, c;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  for (int i = 0; i <= n - 1; i++) {
    scanf("%d", &a[i]);
  }
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= k; i++) {
    scanf("%d%d%d", &u, &vv, &c);
    v[u - 1][vv - 1] = c;
  }
  cout << solve(0, 0, 19) << "\n";
  return 0;
}
