#include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> #include<iomanip> #include<ctime> #include<queue> #include<stack> #define rg register #define lst long long #define N 1050 #define M 10050 using namespace std; int n,m,k,num[N],u,v,w; int down[N],up[N],ans; int arrive[N],peo[N]; int val,idx; inline int read() { rg int s=0,m=1;rg char ch=getchar(); while(ch!=‘-‘&&(ch<‘0‘||ch>‘9‘))ch=getchar(); if(ch==‘-‘)m=-1,ch=getchar(); while(ch>=‘0‘&&ch<=‘9‘)s=(s<<3)+(s<<1)+ch-‘0‘,ch=getchar(); return s*m; } int main() { // freopen("s.in","r",stdin); n=read(),m=read(),k=read(); for(rg int i=1;i<n;++i)num[i]=read(); for(rg int i=1;i<=m;++i) { u=read(),v=read(),w=read(); ans-=u,down[w]++,up[v]=max(u,up[v]); } while(k--) { memset(peo,0,sizeof(peo)); for(rg int i=2;i<=n;++i) arrive[i]=max(arrive[i-1],up[i-1])+num[i-1]; for(rg int i=n;i>=2;--i) { if(num[i-1]) { peo[i-1]=down[i]; if(arrive[i]>up[i]) peo[i-1]+=peo[i]; } else peo[i-1]=0; } val=0,idx=-1; for(rg int i=1;i<=n;++i) if(val<peo[i])val=peo[i],idx=i; if(idx==-1)break; num[idx]--; } for(rg int i=2;i<=n;++i) arrive[i]=max(arrive[i-1],up[i-1])+num[i-1]; for(rg int i=1;i<=n;++i)ans+=arrive[i]*down[i]; printf("%d\n",ans); return 0; }