#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 7;
const int MOD = 1e9 + 7;
const int K = 19;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umod(T& a) {
  while (a < 0) a += MOD;
  a %= MOD;
  return 1;
}
int n, m, k, d[K][K], arr[K];
long long dp[(1 << K)][K];
long long foo(int mask, int x) {
  if (__builtin_popcount(mask) == m) return 0;
  long long& ret = dp[mask][x];
  if (~ret) return ret;
  ret = 0;
  for (int i = 1; i <= n; i++)
    if (!((mask >> (i - 1)) & 1))
      umax(ret, foo(mask | (1 << (i - 1)), i) + arr[i] + d[x][i]);
  return ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &arr[i]);
  for (int i = 1; i <= k; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    d[a][b] = c;
  }
  printf("%lld\n", foo(0, 0));
  return 0;
}
