#include <bits/stdc++.h>
using namespace std;
const int MAXN = 19;
int n, m, k;
int niz[MAXN];
vector<pair<int, int> > prije[MAXN];
long long int rj;
long long int dp[1 << MAXN][MAXN];
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; i++) scanf("%d", &niz[i]);
  for (int i = 0; i < k; i++) {
    int x, y, c;
    scanf("%d %d %d", &x, &y, &c);
    x--;
    y--;
    prije[y].push_back(make_pair(x, c));
  }
  int kraj = 1 << n;
  for (int i = 0; i < n; i++) dp[1 << i][i] = niz[i];
  for (int mask = 1; mask < kraj; mask++)
    for (int i = 0; i < n; i++) {
      if (!((1 << i) & mask)) continue;
      for (int j = 0; j < prije[i].size(); j++) {
        pair<int, int> sad = prije[i][j];
        if (!((1 << sad.first) & mask)) continue;
        if (i == sad.first) continue;
        dp[mask][i] = max(dp[mask][i],
                          dp[mask - (1 << i)][sad.first] + niz[i] + sad.second);
      }
      for (int j = 0; j < n; j++) {
        if (!((1 << j) & mask)) continue;
        if (i == j) continue;
        dp[mask][i] = max(dp[mask][i], dp[mask - (1 << i)][j] + niz[i]);
      }
      if (__builtin_popcount(mask) == m) rj = max(rj, dp[mask][i]);
    }
  cout << rj << endl;
  return 0;
}
