#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T>
T sqr(T a) {
  return a * a;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T sgn(T a) {
  return a > 0 ? 1 : (a < 0 ? -1 : 0);
}
template <typename T>
T abs(T a) {
  return a > 0 ? a : -a;
}
const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int MAXN = 2000001;
const double EPS = 0.0001;
map<pair<ll, ll>, ll> m1;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> a;
  ll size = (1 << n);
  vector<vector<ll>> dp(size, vector<ll>(n + 1));
  for (int i = 0; i < n; i++) {
    ll x;
    cin >> x;
    dp[(1 << i)][i] = x;
    a.push_back(x);
  }
  for (int i = 0; i < k; i++) {
    ll x, y, z;
    cin >> x >> y >> z;
    --x, --y;
    m1[make_pair(x, y)] = z;
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int j = 0; j < n; j++) {
      if (mask & (1 << j)) {
        ll ans = 0;
        for (int k = 0; k < n; k++) {
          if (!(mask & (1 << k))) {
            dp[mask | (1 << k)][k] =
                max(dp[mask | (1 << k)][k],
                    dp[mask][j] + m1[make_pair(k, j)] + a[k]);
          }
        }
      }
    }
  }
  ll ans = 0;
  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;
  return 0;
}
