#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long rase[100][100], satis[100];
long long DP[20][(int)1e6 + 1];
long long solve(int index, int mask) {
  if (DP[index][mask] != -1) {
    return DP[index][mask];
  }
  if (__builtin_popcount(mask) == m) {
    return DP[index][mask] = 0;
  }
  long long res = -1;
  for (int i = 0; i < n; i++) {
    if ((mask & (1 << i)) == false) {
      res = max(res, solve(i, mask | (1 << i)) + satis[i] + rase[index][i]);
    }
  }
  return DP[index][mask] = res;
}
int main() {
  memset(DP, -1, sizeof(DP));
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> satis[i];
  }
  for (int i = 0; i < k; i++) {
    long long x, y, c;
    cin >> x >> y >> c;
    x--;
    y--;
    rase[x][y] = c;
  }
  long long res = -1;
  for (int i = 0; i < n; i++) {
    res = max(res, solve(i, 1 << i) + satis[i]);
  }
  cout << res << endl;
  return 0;
}
