#include <bits/stdc++.h>
using namespace std;
const int MAX = 20;
long long DP[1 << MAX][MAX];
int A[MAX];
int BONUS[MAX][MAX];
int N, M, K;
long long solve(int mask, int last_used) {
  if (__builtin_popcount(mask) == M) return 0;
  if (DP[mask][last_used] != -1) return DP[mask][last_used];
  long long ans = 0;
  for (int i = 1; i <= N; i++)
    if ((mask & (1 << i)) == 0)
      ans = max(ans, solve(mask | (1 << i), i) + BONUS[last_used][i] + A[i]);
  return DP[mask][last_used] = ans;
}
int main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cin >> N >> M >> K;
  for (int i = 1; i <= N; i++) cin >> A[i];
  memset(DP, -1, sizeof DP);
  memset(BONUS, 0, sizeof BONUS);
  while (K--) {
    int x, y, c;
    cin >> x >> y >> c;
    BONUS[x][y] = c;
  }
  cout << solve(0, 0) << "\n";
}
