#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 100500;
const int maxn = 20;
int n, m, k;
int a[maxn];
int e[maxn][maxn];
long long d[1 << 18][maxn];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < (int)(n); ++i) scanf("%d", &a[i]);
  for (int i = 0; i < (int)(k); ++i) {
    int u, v, d;
    scanf("%d%d%d", &u, &v, &d);
    e[u - 1][v - 1] = d;
  }
  for (int i = 0; i < (int)(n); ++i) d[1 << i][i] = a[i];
  long long best = 0;
  for (int mask = 0; mask < (int)(1 << n); ++mask)
    for (int x = 0; x < (int)(n); ++x)
      if (mask & (1 << x)) {
        for (int y = 0; y < (int)(n); ++y)
          if (!(mask & (1 << y))) {
            int nmask = mask | (1 << y);
            d[nmask][y] = max(d[nmask][y], d[mask][x] + a[y] + e[x][y]);
          }
        if (__builtin_popcount(mask) == (size_t)m) {
          best = max(best, d[mask][x]);
        }
      }
  cout << best << endl;
  return 0;
}
