#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int a[18];
int c[18][18];
long long dp[(1 << 18)][18];
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < k; ++i) {
    int x, y, d;
    cin >> x >> y >> d;
    c[y - 1][x - 1] = d;
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    dp[(1 << i)][i] = a[i];
  }
  for (int mask = 0; mask < (1 << n); ++mask) {
    long long sum = 0;
    for (int i = 0; i < n; ++i) {
      if ((1 << i) & mask) continue;
      for (int j = 0; j < n; ++j) {
        if (!((1 << j) & mask)) continue;
        dp[(mask | (1 << i))][i] =
            max(dp[(mask | (1 << i))][i], dp[mask][j] + a[i] + c[i][j]);
      }
    }
  }
  for (int i = 0; i < (1 << n); ++i) {
    if (__builtin_popcount(i) == m) {
      for (int j = 0; j < n; ++j) {
        ans = max(ans, dp[i][j]);
      }
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  for (int i = 1; i <= t; ++i) {
    solve();
  }
}
