#include <bits/stdc++.h>
using namespace std;
const int N = 19;
const long long inf = 2e18;
int n, m, k, a[N], c[N][N];
long long dp[N][1 << N];
long long solve(int cnt, int subset, int prev) {
  if (cnt == m) return 0LL;
  long long &ret = dp[prev][subset];
  if (ret == -1) {
    for (int i = 0; i < n; ++i) {
      if (subset & (1 << i)) continue;
      ret = max(ret, solve(cnt + 1, subset | (1 << i), i + 1) + a[i + 1] +
                         c[prev][i + 1]);
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 0; i < k; ++i) {
    int x, y, _c;
    cin >> x >> y >> _c;
    c[x][y] = _c;
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(0, 0, 0) << '\n';
  return 0;
}
