#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
using namespace std;
const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;
int n, m, k;
int a[N];
int c[20][20];
long long d[N][20];
long long ans;
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= k; i++) {
    int x, y, val;
    cin >> x >> y >> val;
    c[x][y] = val;
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int i = 1; i <= n; i++) {
      if ((mask & (1 << (i - 1))) != 0) {
        d[mask][i] = a[i];
        for (int j = 1; j <= n; j++) {
          if (i != j && (mask & (1 << (j - 1))) != 0) {
            d[mask][i] =
                max(d[mask][i], d[(mask ^ (1 << (i - 1)))][j] + a[i] + c[i][j]);
          }
        }
      }
    }
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    if (__builtin_popcount(mask) == m) {
      for (int i = 1; i <= n; i++) {
        ans = max(ans, d[mask][i]);
      }
    }
  }
  cout << ans << "\n";
  exit(0);
}
