#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long dp[1 << 18][18];
int cost[18][18];
int a[18];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  for (int i = 0, x, y, c; i < k; ++i) {
    scanf("%d%d%d", &x, &y, &c);
    --x;
    --y;
    cost[x][y] = c;
  }
  for (int i = 0; i < n; ++i) dp[1 << i][i] = a[i];
  for (int mask = 1; mask < 1 << n; ++mask) {
    if (mask & (mask - 1)) {
      for (int lst = 0; lst < n; ++lst) {
        if ((mask >> lst) & 1) {
          for (int x = 0; x < n; ++x) {
            if ((mask ^ (1 << lst)) >> x & 1) {
              dp[mask][lst] = max(dp[mask][lst], dp[mask ^ (1 << lst)][x] +
                                                     a[lst] + cost[x][lst]);
            }
          }
        }
      }
    }
  }
  long long best = 0;
  for (int i = 0; i < 1 << n; ++i) {
    if (__builtin_popcount(i) == m) {
      for (int j = 0; j < n; ++j) {
        best = max(best, dp[i][j]);
      }
    }
  }
  cout << best << endl;
  return 0;
}
