#include <bits/stdc++.h>
using namespace std;
const int maxn = 20;
long long dp[1 << 19][maxn];
long long a[maxn];
long long w[maxn][maxn];
int n, m, k;
int cal(int s) {
  int ret = 0;
  for (int i = 0; i < n; i++) ret += (s >> i) & 1;
  return ret;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long x, y, c;
  for (int i = 1; i <= k; i++) {
    cin >> x >> y >> c;
    w[x][y] = c;
  }
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) dp[1 << (i - 1)][i] = a[i];
  long long ans = -1;
  for (int s = 1; s <= (1 << n); s++) {
    if (cal(s) > m) continue;
    for (int x = 1; x <= n; x++) {
      if (!((s >> (x - 1)) & 1)) continue;
      for (int i = 1; i <= n; i++) {
        if (i == x) continue;
        int pre = s ^ (1 << (x - 1));
        if (((pre >> (i - 1)) & 1) == 0) continue;
        if (dp[pre][i] == -1) continue;
        dp[s][x] = max(dp[s][x], dp[pre][i] + w[i][x] + a[x]);
      }
      if (cal(s) == m) ans = max(ans, dp[s][x]);
    }
  }
  cout << ans << endl;
  return 0;
}
