#include <bits/stdc++.h>
using namespace std;
int read() {
  int t = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) f = c ^ 45, c = getchar();
  while (isdigit(c)) t = (t << 1) + (t << 3) + (c ^ 48), c = getchar();
  return f ? t : -t;
}
const int N = 20, NP = (1 << 18) + 10;
long long n, m, k, dl[N], dp[NP][N], g[N][N];
bool check(int x) {
  int rs = 0;
  while (x) rs++, x -= ((x) & -(x));
  return rs == m;
}
int main() {
  n = read(), m = read(), k = read();
  for (int i = 1; i <= n; ++i) dl[i] = read();
  for (int i = 1; i <= k; ++i) g[read()][read()] = read();
  long long ans = 0, sta;
  for (int i = 1; i < (1 << n); ++i)
    for (int j = 1; j <= n; ++j)
      if (i & (1 << j - 1)) {
        if (i == (1 << j - 1))
          dp[i][j] = dl[j], ans = max(ans, check(i) ? dp[i][j] : 0);
        for (int p = 1; p <= n; ++p)
          if (!(i & (1 << p - 1)))
            sta = i | (1 << p - 1),
            dp[sta][p] = max(dp[sta][p], dp[i][j] + g[j][p] + dl[p]),
            ans = max(ans, check(sta) ? dp[sta][p] : 0);
      }
  printf("%lld", ans);
}
