#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long arr[20];
long long extra[20][20];
long long mem[20][(1 << 18) + 2];
long long solve(int pre, int msk, int c) {
  if (c == m) return 0;
  long long &ret = mem[pre][msk];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = 0; i < n; i++) {
    if (msk & (1 << i)) continue;
    ret = max(ret, solve(i, msk | (1 << i), c + 1) + extra[pre][i] + arr[i]);
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int(i) = 0; i < (n); i++) cin >> arr[i];
  long long a, b, c;
  for (int(i) = 0; i < (k); i++) {
    cin >> a >> b >> c;
    extra[a - 1][b - 1] = c;
  }
  memset(mem, -1, sizeof mem);
  cout << solve(19, 0, 0);
}
