#include <bits/stdc++.h>
using namespace std;
const int N = 20;
int n, m, K;
int a[N];
int v[N][N];
long long ans;
long long f[N][1 << N];
inline void smax(long long &x, long long y) { x = x < y ? y : x; }
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
inline int lowbit(int x) { return x & -x; }
inline int count(int x) {
  int ret = 0;
  while (x) {
    x -= lowbit(x);
    ++ret;
  }
  return ret;
}
int main() {
  n = read(), m = read(), K = read();
  for (int i = 0; i < n; ++i) a[i] = read();
  for (int i = 0; i < K; ++i) {
    int x = read(), y = read();
    v[x - 1][y - 1] = read();
  }
  for (int cur = 0; cur < (1 << n); ++cur) {
    bool flag = (count(cur) == m);
    for (int i = 0; i < n; ++i) {
      if (!(cur & (1 << i))) continue;
      int pre = cur - (1 << i);
      if (!pre) {
        f[i][cur] = a[i];
      } else {
        for (int j = 0; j < n; ++j)
          if (i ^ j && pre & (1 << j))
            smax(f[i][cur], f[j][pre] + a[i] + v[j][i]);
      }
      if (flag) smax(ans, f[i][cur]);
    }
  }
  cout << ans << endl;
  return 0;
}
