#include <bits/stdc++.h>
using namespace std;
void rd(long long &x) { scanf("%lld", &x); }
void rd(long long &x, long long &y) { scanf("%lld%lld", &x, &y); }
void rd(long long &x, long long &y, long long &z) {
  scanf("%lld%lld%lld", &x, &y, &z);
}
void rd(long long &x, long long &y, long long &z, long long &s) {
  scanf("%lld%lld%lld%lld", &x, &y, &z, &s);
}
long long dp[(1LL << 18) + 5][20], a[20], n, k, m;
vector<pair<long long, long long> > v[20];
bool getbit(long long x, long long pos) { return x & (1LL << pos); }
long long on(long long x, long long pos) { return x | (1LL << pos); }
long long back(long long mask, long long par) {
  if (__builtin_popcountll(mask) == m) return 0;
  long long &r = dp[mask][par];
  if (r != -1) return r;
  r = -(1LL << 60LL);
  for (long long i = 0; i < (n); i++) {
    if (!getbit(mask, i)) {
      long long sz = v[i].size(), p = 0;
      for (long long j = 0; j < (sz); j++) {
        if (v[i][j].first == par) {
          p = v[i][j].second;
          break;
        }
      }
      r = max(r, p + a[i] + back(on(mask, i), i));
    }
  }
  return r;
}
int main() {
  rd(n, m, k);
  for (long long i = 0; i < (n); i++) rd(a[i]);
  for (long long i = 0; i < (k); i++) {
    long long x, y, c;
    rd(x, y, c);
    x--, y--;
    v[y].push_back(make_pair(x, c));
  }
  memset((dp), -1, sizeof((dp)));
  cout << (long long)back(0, 19);
  return 0;
}
