#include <bits/stdc++.h>
using namespace std;
int n, m, k, x, y, z, a[20], b[20][20];
long long dp[(1 << 20)][20];
long long f(int eaten, int mask, int last) {
  if (eaten == m) return 0;
  if (dp[mask][last] != -1) return dp[mask][last];
  for (int i = 1; i <= n; ++i)
    if ((mask & (1 << i)) == 0)
      dp[mask][last] = max(
          dp[mask][last], a[i] + b[last][i] + f(eaten + 1, mask | (1 << i), i));
  return dp[mask][last];
}
int main() {
  cin >> n >> m >> k;
  memset(dp, -1, sizeof dp);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= k; ++i) {
    cin >> x >> y >> z;
    b[x][y] = z;
  }
  cout << f(0, 0, 0);
  return 0;
}
