#include <bits/stdc++.h>
using namespace std;
vector<int> v;
vector<vector<int> > adjlist;
int n, m, u_, v_, c_, testcase, k;
string s;
char c;
map<pair<int, int>, long long> combo;
long long dp[1 << 20][20];
long long cacl(int state, int ls) {
  if (__builtin_popcount(state) == m) return 0;
  if (dp[state][ls] != -1) {
    return dp[state][ls];
  }
  long long temp = 0;
  for (int i = 1; i <= n; ++i) {
    if (!(state & (1 << i))) {
      temp = max(temp, cacl(state | (1 << i), i) + v[i] + combo[{ls, i}]);
    }
  }
  return dp[state][ls] = temp;
}
int main() {
  cin >> n >> m >> k;
  v.resize(n + 1);
  for (int i = 0; i <= (1 << (n + 1)); ++i) {
    for (int j = 0; j <= n; ++j) {
      dp[i][j] = -1;
    }
  }
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
  }
  for (int i = 1; i <= k; ++i) {
    cin >> u_ >> v_ >> c_;
    combo[{u_, v_}] = c_;
  }
  cout << cacl(0, 0) << endl;
  ;
}
