#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-9;
int INF = 0x7FFFFFFF;
long long INFF = 0x7FFFFFFFFFFFFFFF;
double PI = acos(-1.0);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
inline void scanf(int &d1) { scanf("%d", &d1); }
inline void scanf(int &d1, int &d2) { scanf("%d%d", &d1, &d2); }
inline void scanf(int &d1, int &d2, int &d3) { scanf("%d%d%d", &d1, &d2, &d3); }
inline void scanf(long long &d1) { scanf("%I64d", &d1); }
inline void scanf(long long &d1, long long &d2) {
  scanf("%I64d%I64d", &d1, &d2);
}
inline void scanf(long long &d1, long long &d2, long long &d3) {
  scanf("%I64d%I64d%I64d", &d1, &d2, &d3);
}
inline void scanf(char *temp) { scanf("%s", temp); }
inline void printf(int d1) { printf("%d\n", d1); }
inline void printf(int d1, int d2) { printf("%d %d\n", d1, d2); }
inline void printf(double f1) { printf("%.17g\n", f1); }
inline void printf(long long l1) { printf("%I64d\n", l1); }
inline void printf(long long l1, long long l2) {
  printf("%I64d %I64d\n", l1, l2);
}
inline void printfcase(int id) { printf("Case #%d:", id); }
inline string tostring(int a) {
  char x[100];
  sprintf(x, "%d", a);
  string s = x;
  return s;
}
inline void toupperstring(string &s) {
  for (int(i) = (0); (i) < ((int)s.size()); ++(i)) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      s[i] = s[i] - 'a' + 'A';
    }
  }
}
inline void tolowerstring(string &s) {
  for (int(i) = (0); (i) < ((int)s.size()); ++(i)) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      s[i] = s[i] - 'A' + 'a';
    }
  }
}
inline int toint(string a) {
  char x[100];
  int res;
  strcpy(x, a.c_str());
  sscanf(x, "%d", &res);
  return res;
}
inline void freopen(string sin, string sout) {
  freopen(sin.c_str(), "r", stdin);
  freopen(sout.c_str(), "w", stdout);
}
template <typename T1, typename T2, typename T>
inline typename T::iterator findorinsert(T &m, const T1 &t1, const T2 &t2) {
  typename T::iterator iter = m.find(t1);
  if (iter == m.end()) {
    m.insert(make_pair(t1, t2));
    return m.find(t1);
  } else {
    return iter;
  }
}
template <typename T>
inline T gcd(T u, T v) {
  while (v != 0) {
    T r = u % v;
    u = v;
    v = r;
  }
  return u;
}
template <typename T, int n>
struct Vector {
  T data[n];
  void read() {
    for (int(i) = (0); (i) < (n); ++(i)) {
      cin >> data[i];
    }
  }
  inline T operator*(const Vector<T, n> &v) const {
    T res = 0;
    for (int(i) = (0); (i) < (n); ++(i)) {
      res += data[i] * v[i];
    }
    return res;
  }
  inline bool operator<(const Vector<T, n> &v) const {
    for (int(i) = (0); (i) < (n); ++(i)) {
      if (data[i] != v[i]) {
        return data[i] < v[i];
      }
    }
    return false;
  }
  inline bool operator==(const Vector<T, n> &v) const {
    for (int(i) = (0); (i) < (n); ++(i)) {
      if (data[i] != v[i]) {
        return false;
      }
    }
    return true;
  }
  inline T &operator[](int id) { return data[id]; }
  inline T operator[](int id) const { return data[id]; }
  inline int size() const { return n; }
};
template <typename T>
inline Vector<T, 2> make_vector(const T &t1, const T &t2) {
  Vector<T, 2> res = {t1, t2};
  return res;
}
template <typename T>
inline Vector<T, 3> make_vector(const T &t1, const T &t2, const T &t3) {
  Vector<T, 3> res = {t1, t2, t3};
  return res;
}
template <typename T, int n>
struct Matrix {
  Vector<T, n> data[n];
  inline Vector<T, n> operator*(const Vector<T, n> &v) const {
    Vector<T, n> res;
    for (int(i) = (0); (i) < (n); ++(i)) {
      res[i] = data[i] * v;
    }
    return res;
  }
  inline Matrix<T, n> operator*(const Matrix<T, n> &m) const {
    Matrix<T, n> res;
    for (int(i) = (0); (i) < (n); ++(i)) {
      Vector<T, n> temp;
      for (int(j) = (0); (j) < (n); ++(j)) {
        temp[j] = m[j][i];
      }
      for (int(j) = (0); (j) < (n); ++(j)) {
        res[j][i] = data[j] * temp;
      }
    }
    return res;
  }
  static inline Matrix<T, n> identity() {
    Matrix<T, n> res;
    for (int(i) = (0); (i) < (n); ++(i)) {
      memset(res[i].data, 0, sizeof(T) * n);
    }
    for (int(i) = (0); (i) < (n); ++(i)) {
      res[i][i] = 1;
    }
    return res;
  }
  Vector<T, n> &operator[](int id) { return data[id]; }
  Vector<T, n> operator[](int id) const { return data[id]; }
  int size() const { return n; }
};
template <typename T, int n>
class BIT {
 public:
  BIT(int size = n) {
    memset(bit, 0, sizeof(bit));
    this->size = size;
  }
  BIT(T *data, int size = n) {
    this->size = size;
    for (int i = 1; i <= size; i++) {
      bit[i] = data[i - 1];
      for (int j = i - 1; j > i - lowbit(i); j--) {
        bit[i] += bit[j];
      }
    }
  }
  void edit(int i, T delta) {
    for (int j = i + 1; j <= size; j += lowbit(j)) {
      bit[j] += delta;
    }
  }
  T sum(int k) {
    T ans = 0;
    for (int i = k + 1; i > 0; i -= lowbit(i)) {
      ans += bit[i];
    }
    return ans;
  }

 private:
  T bit[n + 1];
  int size;
  inline int lowbit(int x) const { return x & (-x); }
};
class Prime {
 public:
  Prime(int num) {
    bits.resize(num + 1, true);
    sieve();
    collect();
  }
  bool is_prime(int num) const { return bits[num]; }
  int find1factor(int num) const {
    for (int(i) = (0); (i) < ((int)results.size()); ++(i)) {
      if (num % results[i] == 0) {
        return results[i];
      }
    }
    return num;
  }

 private:
  vector<bool> bits;
  vector<int> results;
  void sieve() {
    bits[0] = false;
    bits[1] = false;
    for (int i = 2; i < (int)bits.size(); ++i) {
      if (bits[i] == true) {
        for (int j = 2;; ++j) {
          int v2 = j * i;
          if (v2 >= (int)bits.size()) {
            break;
          }
          bits[v2] = false;
        }
      }
    }
  }
  void collect() {
    for (int i = 0; i < (int)bits.size(); ++i) {
      if (bits[i]) {
        results.push_back(i);
      }
    }
  }
};
template <int n, int m>
struct Graph {
  int head[n], edge_id;
  struct {
    int to, next;
  } edges[m];
  void init(int num = n) {
    edge_id = 0;
    memset(head, -1, sizeof(int) * num);
  }
  int add(int from, int to) {
    edges[edge_id].next = head[from];
    edges[edge_id].to = to;
    head[from] = edge_id;
    edge_id++;
    return head[from];
  }
  inline int next(int edge) const { return edges[edge].next; }
  inline int to(int edge) const { return edges[edge].to; }
};
template <class T>
inline void hash_combine(std::size_t &seed, const T &v) {
  std::hash<T> hasher;
  seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
template <typename T, int n>
struct VectorHash {
  inline std::size_t operator()(const Vector<T, n> &v) const {
    std::size_t seed = 0;
    for (int(i) = (0); (i) < (n); ++(i)) {
      hash_combine(seed, v[i]);
    }
    return seed;
  }
};
const int max_n = 18;
long long data[max_n];
long long cs[max_n][max_n];
long long dp[1 << max_n][max_n];
int dp_last[48620], dp_new[48620], dp_l, dp_n;
bool dp_visisted[1 << max_n];
int bittest[max_n];
int n, m;
int main() {
  int k;
  scanf(n, m, k);
  for (int(i) = (0); (i) < (n); ++(i)) {
    scanf(data[i]);
  }
  memset(dp_visisted, false, sizeof(dp_visisted));
  memset(cs, 0, sizeof(cs));
  for (int(i) = (0); (i) < (k); ++(i)) {
    int x, y, c;
    scanf(x, y, c);
    x--;
    y--;
    cs[x][y] = c;
  }
  memset(dp, -1, sizeof(dp));
  int state = 1, dp_l = 0;
  for (int(i) = (0); (i) < (n); ++(i)) {
    bittest[i] = state;
    dp_last[i] = state;
    dp[state][i] = data[i];
    dp_visisted[state] = true;
    state <<= 1;
    dp_l++;
  }
  for (int(i) = (0); (i) < (m - 1); ++(i)) {
    dp_n = 0;
    for (int(j) = (0); (j) < (dp_l); ++(j)) {
      int last_state = dp_last[j];
      for (int(k) = (0); (k) < (n); ++(k)) {
        if ((last_state & bittest[k]) == 0) {
          int new_state = last_state | bittest[k];
          long long res = 0;
          for (int(l) = (0); (l) < (n); ++(l)) {
            if (dp[last_state][l] != -1) {
              res = max(res, dp[last_state][l] + data[k] + cs[l][k]);
            }
          }
          dp[new_state][k] = res;
          if (dp_visisted[new_state] == false) {
            dp_new[dp_n] = new_state;
            dp_n++;
            dp_visisted[new_state] = true;
          }
        }
      }
    }
    dp_l = dp_n;
    for (int(j) = (0); (j) < (dp_n); ++(j)) {
      dp_last[j] = dp_new[j];
    }
  }
  long long res = 0;
  for (int(i) = (0); (i) < (dp_l); ++(i)) {
    for (int(j) = (0); (j) < (n); ++(j)) {
      res = max(res, dp[dp_last[i]][j]);
    }
  }
  printf(res);
  return 0;
}
