#include <bits/stdc++.h>
using namespace std;
const int N = (int)500;
const int linf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const int sN = (int)27000;
inline void ioi2020() {}
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll n, m, k;
ll a[N];
ll dp[(1 << 20)][20];
map<ll, ll> mp[N];
int main() {
  ioi2020();
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    mp[a - 1][b - 1] = c;
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int bit = 0; bit < n; bit++) {
      if ((mask >> bit) & 1) {
        for (int sbit = 0; sbit < n; sbit++) {
          if ((mask >> sbit) & 1) dp[mask][bit] += a[sbit];
        }
      }
    }
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int bit = 0; bit < n; bit++) {
      if (!((mask >> bit) & 1)) {
        for (int sbit = 0; sbit < n; sbit++) {
          if ((mask >> sbit) & 1)
            dp[(mask ^ (1 << bit))][bit] =
                max(dp[(mask ^ (1 << bit))][bit],
                    dp[mask][sbit] + mp[sbit][bit] + a[bit]);
        }
      }
    }
  }
  ll res = 0;
  for (int mask = 0; mask < (1 << n); mask++) {
    if (__builtin_popcount(mask) == m) {
      for (int bit = 0; bit < n; bit++) {
        res = max(res, dp[mask][bit]);
      }
    }
  }
  cout << res;
}
