#include <map>
#include <set>
#include <queue>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;
using lnt = long long;

const int mxn = 100005;
const int mxm = 105;

int n, m, p, d[mxn];
lnt a[mxn];
lnt s[mxn];
lnt f[mxm][mxn];

signed main() {
		scanf("%d%d%d", &n, &m, &p);
		for (int i = 2; i <= n; ++i)
			scanf("%d", d + i), d[i] += d[i - 1];
		for (int i = 1; i <= m; ++i) {
			int h, t;
			scanf("%d%d", &h, &t);
			a[i] = t - d[h];
		}
		sort(a + 1, a + m + 1);
		for (int i = 1; i <= m; ++i)
			s[i] = s[i - 1] + a[i];
//		for (int i = 1; i <= m; ++i)
//			cerr << a[i] << " ";
//		cerr << endl;
		p = min(p, m);
		for (int i = 1; i <= p; ++i) {
			if (i == 1) {
				f[i][0] = 0;
				for (int j = 1; j <= m; ++j)
					f[i][j] = a[j] * j - s[j];
			} else {
				static int q[mxn];
				static lnt x[mxn], y[mxn];
				for (int j = 0; j <= m; ++j) {
					x[j] = j;
					y[j] = f[i-1][j] + s[j];
				}
				int l = 0, r = 0;
				q[r++] = 0;
				for (int j = 1; j <= m; ++j) {
					while (r - l > 1) {
						int u = q[l];
						int v = q[l + 1];
						lnt fu = y[u] - a[j] * x[u];
						lnt fv = y[v] - a[j] * x[v];
						if (fu >= fv)
							l++;
						else
							break;
					}
					int k = q[l];
					f[i][j] = a[j]*j - s[j] + y[k] - a[j]*x[k];
//					cerr << i << " " << j << " = " << f[i][j] << endl;
					while (r - l > 1) {
						int u = q[r - 2];
						int v = q[r - 1];
						int w = j;
						// (y[u] - y[v]) / (x[u] - x[v]) >= (y[v] - y[w]) / (x[v] - x[w]) => pop
						if ((y[u] - y[v]) * (x[v] - x[w]) >= (y[v] - y[w]) * (x[u] - x[v]))
							r--;
						else
							break;
					}
					q[r++] = j;
				}
			}
		}
		printf("%lld\n", f[p][m]);
	return 0;
}


#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<bitset>
#include<cstdio>
#include<string>
#include<time.h>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int N=1e5+5,M=105;
long long f[N],s[N];
int a[N],b[N],d[N];
int main()
{
	int n,m,p,g,t,h,l,r,c=2100000000;
	scanf("%d%d%d",&n,&m,&p);
	for(int i=2;i<=n;i++)
	{
		scanf("%d",&g);
		b[i]=b[i-1]+g;
	}
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&h,&t);
		a[i]=t-b[h];
	}
	for(int i=1;i<=m;i++)
		c=min(a[i],c);
	if(c<0)
		for(int i=1;i<=m;i++)
			a[i]-=c;
	sort(a+1,a+m+1);
	for(int i=1;i<=m;i++)
		s[i]=s[i-1]+a[i];
	for(int i=1;i<=m;i++)
		f[i]=1ll*a[i]*i-s[i];
	for(int i=2;i<=p;i++)
	{
		r=0;
		l=1;
		for(int j=m;j!=-1;j--)
		{
			while((f[d[r]]+s[d[r]]-f[j]-s[j])*(d[r-1]-d[r])>=(f[d[r-1]]+s[d[r-1]]-f[d[r]]-s[d[r]])*(d[r]-j)&&r>1)
				r--;
			d[++r]=j;
		}
		for(int j=m;j;j--)
		{
			while(f[d[l]]+s[d[l]]-f[d[l+1]]-s[d[l+1]]>=1ll*a[j]*(d[l]-d[l+1])&&l<r||d[l]>=j)
				l++;
			f[j]=f[d[l]]+1ll*a[j]*(j-d[l])-s[j]+s[d[l]];
		}
	}
	printf("%lld",f[m]);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#define ll long long
#define min(x,y) (x<y?x:y)
using namespace std;
int n,m,people,l,r;
bitset<100> a[100];
ll INF,f[110][100010],fuck[100010],sumfuck[100010],sumt[100010],stk[100010],y[100010];
inline int read()
{
    int y=0,f=1;
    char c=getchar();
    for(;!isdigit(c);c=getchar())
        if(c=='-')
            f=-1;
    for(;isdigit(c);c=getchar())
        y=(y<<3)+(y<<1)+c-'0';
    return y*f;
}
int main()
{
    register int i,j,k;
	n=read();
	m=read();
	people=read();
	for(i=2;i<=n;++i)
	{
		j=read();
		sumt[i]=sumt[i-1]+j;
	}
	for(i=1;i<=m;i++)
	{
		j=read();
		k=read();
		fuck[i]=k-sumt[j];
	}
	sort(fuck+1,fuck+1+m);
	for(i=1;i<=m;i++)sumfuck[i]=sumfuck[i-1]+fuck[i];
	memset(f,0x3f,sizeof(f));
	INF=f[0][0];
	f[0][0]=0;
	for(i=1;i<=people;++i)
	{
		for(k=1;k<=m;++k) y[k]=f[i-1][k];
		l=r=1;
		stk[1]=0;
		for(j=1;j<=m;j++)
		{
			while( l<r && y[stk[l+1]] - y[stk[l]] <= fuck[j] * (stk[l+1] - stk[l])) l++;
			f[i][j]=min(f[i-1][j] , y[stk[l]] + fuck[j] * (j-stk[l]) - sumfuck[j]-sumfuck[k]);
			if(y[j]>=INF)continue;
			while(l<r && (y[j]-y[stk[r]]) * (stk[r]-stk[r-1]) <= (y[stk[r]] - y[stk[r-1]]) * (j-stk[r]) ) r--;
			stk[++r]=j;
		}
	}
	cout<<f[people][m]<<endl;
}


#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
typedef long long ll;
using namespace std;
int n,m,p,q[100010];
long long d[100010],a[100010],sum[100010],f[101][100010];

inline ll read()
{
    ll f=1,num=0;   char ch=getchar();
    while(0==isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(0!=isdigit(ch)) num=(num<<1)+(num<<3)+ch-'0',ch=getchar();
    return num*f;
}

int main(){
	n=read(),m=read(),p=read();    ll h;
	for(int i=2;i<=n;i++)d[i]=read()+d[i-1];
	for(int i=1;i<=m;i++)h=read(),a[i]=read()-d[h];
	sort(a+1,a+m+1);
	for(int i=1;i<=m;i++)sum[i]=sum[i-1]+a[i],f[0][i]=0x3F3F3F3F3F3F3F3Fll;

	for(int i=1;i<=p;i++){
	 int l=1,r=1; q[1]=0;
	 for(int j=1;j<=m;j++){
	 	ll xl=f[i-1][q[l]]+sum[q[l]];
	 	ll xl_=f[i-1][q[l+1]]+sum[q[l+1]];
	 	while(l<r&& (xl_-xl)<=(q[l+1]-q[l])*(ll)a[j] ) l++;

	 	f[i][j]=f[i-1][q[l]]+(ll)a[j]*(j-q[l])-sum[j]+sum[q[l]] ;

	 	ll xr=f[i-1][q[r]]+sum[q[r]];
	 	ll xj=f[i-1][j]+sum[j];
	 	ll xr_=f[i-1][q[r-1]]+sum[q[r-1]];
	 	while(l<r&& (xr-xr_)*(ll)(j-q[r])>=(xj-xr)*(ll)(q[r]-q[r-1]) ) r--;
	 	q[++r]=j;
	 }
	}
	printf("%lld\n",f[p][m]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define maxn 100010
#define maxp 110
#define INF (1LL<<62)
template <typename T>inline T read()
{
    register T sum=0;
    char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
	read(b...);
}
int n,m,p,head,tail,Q[maxn];
long long ans=INF,dis[maxn],f[maxp][maxn],sum[maxn],t[maxn];
long long calc(int k,int i,int j)
{
	return ((f[k][j]+sum[j])-(f[k][i]+sum[i]));///(1.*(j-i));
}
int main()
{
	read(n,m,p);
	for(int i=2;i<=n;i++)dis[i]=dis[i-1]+read<long long>();
	for(int i=1;i<=m;i++)
	{
		int x=read<int>();
		t[i]=read<long long>()-dis[x];
	}
	sort(t+1,t+1+m);
	for(int i=1;i<=m;i++)sum[i]=sum[i-1]+t[i],f[0][i]=INF;
	for(int i=1;i<=p;i++)
	{
		Q[0]=0;
		head=0,tail=1;
		for(int j=1;j<=m;j++)
		{
			while(head<tail-1&&calc(i-1,Q[head],Q[head+1])<=t[j]*(Q[head+1]-Q[head]))head+=1;
			f[i][j]=f[i-1][Q[head]]+(j-Q[head])*t[j]-sum[j]+sum[Q[head]];
			while(head<tail-1&&calc(i-1,Q[tail-2],Q[tail-1])*(j-Q[tail-1])>=calc(i-1,Q[tail-1],j)*(Q[tail-1]-Q[tail-2]))
				tail-=1;
			Q[tail++]=j;
		}
		ans=min(ans,f[i][m]);
	}
	printf("%lld\n",ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long int F[110][110000], Sum[110000], Y[110000];
long long int Q[1110000], Num, T, JL[110000], N, M, P, H;
long long int Alone[110000];

int main(void) {
    cin >> N >> M >> P;
    for (register int i = 2; i <= N; i++) {
        cin >> JL[i];
        JL[i] = JL[i] + JL[i - 1];
    }
    for (register int i = 1; i <= M; i++) {
        cin >> Num >> T;
        T = T - JL[Num];
        Sum[i] = T;
    }
    sort(Sum + 1, Sum + 1 + M);
    for (register int i = 1; i <= M; i++) Alone[i] = Sum[i];
    for (register int i = 1; i <= M; i++) Sum[i] = Sum[i - 1] + Sum[i];
    memset(F, 0x3f, sizeof(F));
    F[0][0] = 0;
    for (register int i = 1; i <= P; i++) {
        Q[1] = 0, H = T = 1;
        for (register int j = 1; j <= M; j++) Y[j] = F[i - 1][j] + Sum[j];
        for (register int j = 1; j <= M; j++) {
            while (H < T && (Y[Q[H + 1]] - Y[Q[H]]) <= (Q[H + 1] - Q[H]) * Alone[j]) H++;
            register int k = Q[H];
            F[i][j] = min(F[i - 1][j], Y[k] + Alone[j] * (j - k) - Sum[j]);
            if (Y[j] >= 0x3f3f3f3f3f3f3f3fll)
                continue;
            while (H < T && ((Y[j] - Y[Q[T]]) * (Q[T] - Q[T - 1]) <= (Y[Q[T]] - Y[Q[T - 1]]) * (j - Q[T])))
                T--;
            Q[++T] = j;
        }
    }
    cout << F[P][M] << endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define Maxn 100005
using namespace std;
ll read()
{
	ll r=0,f=1;char c=getchar();
	while((c<'0'||c>'9')&&(c!='-')) c=getchar();
	if(c=='-') f=-1,c=getchar();
	while(c>='0'&&c<='9') r=r*10+c-'0',c=getchar();
	return r*f;
}
ll l,r,dp[110][Maxn],n,m,p,sum[Maxn],a[Maxn],sumd[Maxn],q[Maxn],g[Maxn];
int main()
{
	n=read(),m=read(),p=read();
	for(int i=2;i<n;i++)
	{
		ll j=read();
		sumd[i]=sumd[i-1]+j;
	}
	for(int i=1;i<=m;i++)
	{
		ll j=read(),k=read();
		a[i]=k-sumd[j];
	}
	sort(a+1,a+m+1);
	for(int i=1;i<=m;i++) sum[i]=sum[i-1]+a[i];
	memset(dp,0x7f,sizeof(dp));
	dp[0][0]=0;
	for(int i=1;i<=p;i++)
	{
		for(int j=1;j<=m;j++) g[j]=dp[i-1][j]+sum[j];
		q[l=r=1]=0;
		for(int j=1;j<=m;j++)
		{
			while(l<r&&g[q[l+1]]-g[q[l]]<=a[j]*(q[l+1]-q[l]))	l++;
			dp[i][j]=min(dp[i-1][j],g[q[l]]+a[j]*(j-q[l])-sum[j]);
			if(g[j]>=0x3f3f3f3f3f3f3f3f3fll) continue;
			while(l<r&&(g[j]-g[q[r]])*(q[r]-q[r-1])<=(g[q[r]]-g[q[r-1]]*(j-q[r])))	r--;
			q[++r]=j;
		}
	}
	cout<<dp[p][m]<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define N 100005
#define P 105
using namespace std;
int n, m, p, d[N], sumd[N], a[N], suma[N], f[P][N], minn = INT_MAX;
int main(){
    cout << "0";
	scanf("%d%d%d", &n, &m, &p);
	for(int i = 2; i <= n; ++i){
		scanf("%d", &d[i]);
		sumd[i] = sumd[i - 1] + d[i];
	}
	for(int i = 1; i <= m; ++i){
		int h, t;
		scanf("%d%d", &h, &t);
		a[i] = t - sumd[h];
	}
	sort(a + 1, a + 1 + m);
	for(int i = 1; i <= m; ++i) suma[i] = suma[i - 1] + a[i];
	memset(f, 0x3f, sizeof(f));
	f[0][0] = f[1][0] = 0;
	for(int i = 1; i <= p; ++i){
		for(int j = 1; j <= m; ++j){
			for(int k = 0; k < j; ++k){
				f[i][j] = min(f[i][j], f[i - 1][k] + a[j] * (j - k) - (suma[j] - suma[k]));
			}
		}
	}
	cout << f[p][m];
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<queue>
#include<map>
using namespace std;

const long long maxn=1e5+10;

long long n,m,p,d[maxn],a[maxn],q[maxn],sum[maxn],g[maxn],f[110][maxn];

long long read()
{
    char c=getchar();
    long long num=0,f=1;
    while(c<'0'||c>'9')
    {
        if(c=='-') f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9')
    {
        num=num*10-'0'+c;
        c=getchar();
    }
    return f*num;
}

int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    n=read(); m=read(); p=read();
    for(int i=2; i<=n; i++) d[i]=d[i-1]+read();
    long long h,t;
    for(int i=1; i<=m; i++) h=read(),t=read(),a[i]=t-d[h];
    sort(a+1,a+m+1);
    for(int i=1; i<=m; i++) sum[i]=sum[i-1]+a[i];
    memset(f,0x3f3f3f3f3f3f3f3fll,sizeof(f));
    f[0][0]=0;
    for(int i=1; i<=p; i++)
    {
    	for(int j=1; j<m; j++) g[j]=f[i-1][j]+sum[j];
    	long long l=1,r=1;
    	q[1]=0;
    	for(int j=1; j<=m; j++)
    	{
    		while(l<r&&(g[q[l+1]]-g[q[l]])<=a[j]*(q[l+1]-q[l])) l++;
    		f[i][j]=f[i-1][q[l]]+j*a[j]-q[l]*a[j]-sum[j]+sum[q[l]];
    		while(l<r&&(g[q[r]]-g[q[r-1]])*(j-q[r])>=(g[j]-g[q[r]])*(q[r]-q[r-1])) r--;
    		r++; q[r]=j;
		}
	}
	printf("%lld\n",f[p][m]);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;

const ll inf = (ll)4e18;
ll dp[P][N];

ll s[N];

ll ct[N];
ll pref[N];

struct Line{
    ll a;
    ll b;
    ll ps;
};

ll dl(ll x, ll y){
    return (x/y - ((x ^ y) < 0 && x%y != 0));
}

ll intersectx(Line A, Line B){
    return dl(A.b-B.b,B.a-A.a);
}

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    for(int j = 0 ; j <= p ; j ++ )
        for(int i = 0 ; i <= m ; i ++ ){
            dp[j][i] = inf;
        }
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tim;
    for(int i = 1; i <= m ; i ++ ){
        cin >> id >> tim;
        ct[i] = tim - s[id];
    }
    sort(ct + 1, ct + m + 1);
    for(int i = 1; i <=  m ; i ++ ){
        pref[i] = pref[i - 1] + ct[i];
    }
    dp[1][0] = inf;
    for(int i = 1; i <= m ; i ++ ){
        dp[1][i] = ct[i] * i - pref[i];
    }
    Line nw;
    Line v2, v1;
    int sz;
    ll F;
    for(int d = 2 ; d <= p ; d ++ ){
        deque<Line> hull;
        for(int i = 1; i <= m; i ++ ){
            nw.a = i;
            nw.b = -dp[d-1][i-1] - pref[i-1];
            nw.ps = inf;
            while(hull.size() > 1){
                sz = hull.size();
                v2 = hull[sz - 1];
                v1 = hull[sz - 2];
                if(v1.ps >= intersectx(v2, nw)){
                    hull[sz - 2].ps = intersectx(v1,nw);
                    hull.pop_back();
                }
                else{
                    break;
                }
            }
            if(!hull.empty()){
                sz = hull.size();
                hull[sz - 1].ps = intersectx(hull[sz-1], nw);
            }
            hull.push_back(nw);
            while(ct[i] > hull.front().ps)
                hull.pop_front();
            dp[d][i] = min(dp[d][i], -(hull.front().a * ct[i] + hull.front().b) + ct[i] * i - pref[i - 1]);
        }
    }
    cout << dp[p][n];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;

const ll inf = (ll)4e18;
ll dp[P][N];

ll s[N];

ll ct[N];
ll pref[N];

struct Line{
    ll a;
    ll b;
    ll ps;
};

ll dl(ll x, ll y){
    return (x/y - ((x ^ y) < 0 && x%y != 0));
}

ll intersectx(Line A, Line B){
    return dl(A.b-B.b,B.a-A.a);
}

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    for(int j = 0 ; j <= p ; j ++ )
        for(int i = 0 ; i <= m ; i ++ ){
            dp[j][i] = inf;
        }
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tim;
    for(int i = 1; i <= m ; i ++ ){
        cin >> id >> tim;
        ct[i] = s[id] - tim;
    }
    sort(ct + 1, ct + m + 1);
    for(int i = 1; i <=  m ; i ++ ){
        pref[i] = pref[i - 1] + ct[i];
    }
    dp[0][0] = 0;
    int sz;
    ll F;
    for(int d = 1 ; d <= p ; d ++ ){
        for(int i = 1; i <= m; i ++ ){
            for(int j = i ; j >= 1; j -- ){
                dp[d][i] = min(dp[d][i], dp[d-1][j-1] + (i - j + 1) * ct[i] - (pref[i] - pref[j-1]));
            }
        }
    }
    cout << dp[p][m] << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;

const ll inf = (ll)4e18;
ll dp[P][N];

ll s[N];

ll ct[N];
ll pref[N];

struct Line{
    ll a;
    ll b;
    ll ps;
};

ll dl(ll x, ll y){
    return (x/y - ((x ^ y) < 0 && x%y != 0));
}

ll intersectx(Line A, Line B){
    return dl(A.b-B.b,B.a-A.a);
}

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    for(int j = 0 ; j <= p ; j ++ )
        for(int i = 0 ; i <= m ; i ++ ){
            dp[j][i] = inf;
        }
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tim;
    for(int i = 1; i <= m ; i ++ ){
        cin >> id >> tim;
        ct[i] = s[id] - tim;
    }
    sort(ct + 1, ct + m + 1);
    for(int i = 1; i <=  m ; i ++ ){
        pref[i] = pref[i - 1] + ct[i];
    }
    dp[1][0] = inf;
    for(int i = 1; i <= m ; i ++ ){
        dp[1][i] = ct[i] * i - pref[i];
    }
    Line nw;
    Line v2, v1;
    int sz;
    ll F;
    for(int d = 2 ; d <= p ; d ++ ){
        for(int i = 1; i <= m; i ++ ){
            for(int j = i ; j >= 1; j -- ){
                dp[d][i] = min(dp[d][i], dp[d-1][j-1] + ct[i] * (i-j+1) - (pref[i] - pref[j-1]));
            }
        }
    }
    cout << dp[p][m];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;

const ll inf = (ll)4e18;
ll dp[P][N];

ll s[N];

ll ct[N];
ll pref[N];

struct Line{
    ll a;
    ll b;
    ll ps;
};

ll dl(ll x, ll y){
    return (x/y - ((x ^ y) < 0 && x%y != 0));
}

ll intersectx(Line A, Line B){
    return dl(A.b-B.b,B.a-A.a);
}

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    for(int j = 0 ; j <= p ; j ++ )
        for(int i = 0 ; i <= m ; i ++ ){
            dp[j][i] = inf;
        }
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tim;
    for(int i = 1; i <= m ; i ++ ){
        cin >> id >> tim;
        ct[i] = s[id] - tim;
    }
    sort(ct + 1, ct + m + 1);
    for(int i = 1; i <=  m ; i ++ ){
        pref[i] = pref[i - 1] + ct[i];
    }
    dp[0][0] = 0;
    int sz;
    ll F;
    for(int d = 1 ; d <= p ; d ++ ){
        for(int i = 1; i <= m; i ++ ){
            for(int j = i ; j >= 1; j -- ){
                dp[d][i] = min(dp[d][i], dp[d-1][j-1] + ct[i] * (i-j+1) - (pref[i] - pref[j-1]));
            }
        }
    }
    cout << dp[p][m];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;

const ll inf = (ll)4e18;
ll dp[P][N];

ll s[N];

ll ct[N];
ll pref[N];

struct Line{
    ll a;
    ll b;
    ll ps;
};

ll dl(ll x, ll y){
    return (x/y - ((x ^ y) < 0 && x%y != 0));
}

ll intersectx(Line A, Line B){
    return dl(A.b-B.b,B.a-A.a);
}

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    for(int j = 0 ; j <= p ; j ++ )
        for(int i = 0 ; i <= m ; i ++ ){
            dp[j][i] = inf;
        }
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tim;
    for(int i = 1; i <= m ; i ++ ){
        cin >> id >> tim;
        ct[i] = s[id] - tim;
    }
    sort(ct + 1, ct + m + 1);
    for(int i = 1; i <=  m ; i ++ ){
        pref[i] = pref[i - 1] + ct[i];
    }
    dp[1][0] = inf;
    for(int i = 1; i <= m ; i ++ ){
        dp[1][i] = ct[i] * i - pref[i];
    }
    Line nw;
    Line v2, v1;
    int sz;
    ll F;
    for(int d = 2 ; d <= p ; d ++ ){
        deque<Line> hull;
        for(int i = 1; i <= m; i ++ ){
            nw.a = i;
            nw.b = -dp[d-1][i-1] - pref[i-1];
            nw.ps = inf;
            while(hull.size() > 1){
                sz = hull.size();
                v2 = hull[sz - 1];
                v1 = hull[sz - 2];
                if(v1.ps >= intersectx(v2, nw)){
                    hull[sz - 2].ps = intersectx(v1,nw);
                    hull.pop_back();
                }
                else{
                    break;
                }
            }
            if(!hull.empty()){
                sz = hull.size();
                hull[sz - 1].ps = intersectx(hull[sz-1], nw);
            }
            hull.push_back(nw);
            while(ct[i] > hull.front().ps)
                hull.pop_front();
            dp[d][i] = min(dp[d][i], -(hull.front().a * ct[i] + hull.front().b) + ct[i] * i - pref[i - 1]);
        }
    }
    cout << dp[p][m];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;

const ll inf = (ll)4e18;
ll dp[P][N];

ll s[N];

ll ct[N];
ll pref[N];

struct Line{
    ll a;
    ll b;
    ll ps;
};

ll dl(ll x, ll y){
    return (x/y - ((x ^ y) < 0 && x%y != 0));
}

ll intersectx(Line A, Line B){
    return dl(A.b-B.b,B.a-A.a);
}

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    for(int j = 0 ; j <= p ; j ++ )
        for(int i = 0 ; i <= m ; i ++ ){
            dp[j][i] = inf;
        }
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tim;
    for(int i = 1; i <= m ; i ++ ){
        cin >> id >> tim;
        ct[i] = s[id] - tim;
    }
    sort(ct + 1, ct + m + 1);
    for(int i = 1; i <=  m ; i ++ ){
        pref[i] = pref[i - 1] + ct[i];
    }
    dp[1][0] = inf;
    for(int i = 1; i <= m ; i ++ ){
        dp[1][i] = ct[i] * i - pref[i];
    }
    Line nw;
    Line v2, v1;
    int sz;
    ll F;
    for(int d = 2 ; d <= p ; d ++ ){
        deque<Line> hull;
        for(int i = 1; i <= m; i ++ ){
            nw.a = i;
            nw.b = -dp[d-1][i-1] - pref[i-1];
            nw.ps = inf;
            while(hull.size() > 1){
                sz = hull.size();
                v2 = hull[sz - 1];
                v1 = hull[sz - 2];
                if(v1.ps >= intersectx(v2, nw)){
                    hull[sz - 2].ps = intersectx(v1,nw);
                    hull.pop_back();
                }
                else{
                    break;
                }
            }
            if(!hull.empty()){
                sz = hull.size();
                hull[sz - 1].ps = intersectx(hull[sz-1], nw);
            }
            hull.push_back(nw);
            while(ct[i] > hull.front().ps)
                hull.pop_front();
            dp[d][i] = min(dp[d][i], -(hull.front().a * ct[i] + hull.front().b) + ct[i] * i - pref[i - 1]);
        }
    }
    cout << dp[p][n];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;

const ll inf = (ll)4e18;
ll dp[P][N];

ll s[N];

ll ct[N];
ll pref[N];

struct Line{
    ll a;
    ll b;
    ll ps;
};

ll dl(ll x, ll y){
    return (x/y - ((x ^ y) < 0 && x%y != 0));
}

ll intersectx(Line A, Line B){
    return dl(A.b-B.b,B.a-A.a);
}

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    for(int j = 0 ; j <= p ; j ++ )
        for(int i = 0 ; i <= m ; i ++ ){
            dp[j][i] = inf;
        }
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tim;
    for(int i = 1; i <= m ; i ++ ){
        cin >> id >> tim;
        ct[i] = s[id] - tim;
    }
    sort(ct + 1, ct + m + 1);
    for(int i = 1; i <=  m ; i ++ ){
        pref[i] = pref[i - 1] + ct[i];
    }
    dp[1][0] = inf;
    for(int i = 1; i <= m ; i ++ ){
        dp[1][i] = ct[i] * i - pref[i];
    }
    Line nw;
    Line v2, v1;
    int sz;
    ll F;
    for(int d = 2 ; d <= p ; d ++ ){
        for(int i = 1; i <= m; i ++ ){
            for(int j = i ; j >= 1; j -- ){
                dp[d][i] = min(dp[d][i], dp[d-1][j-1] + ct[i] * i - ct[i] * j - pref[i-1] + pref[j-1]);
            }
        }
    }
    cout << dp[p][m];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;
const ll inf = (ll) 4e18;

ll s[N];
ll cat[N];
ll pref[N];
ll dp[P][N];

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tm;
    for(int i = 1 ; i <= m ; i ++ ){
        cin >> id >> tm;
        cat[i] = tm - s[id];
    }
    sort(cat + 1, cat + m + 1);
    for(int i = 1; i <= m; i ++ ){
        pref[i] = pref[i-1] + cat[i];
    }
    for(int i = 0; i < P; i ++ ) for (int j = 0 ; j < N ; j ++ ){
        dp[i][j] = inf;
    }
    dp[0][0] = 0;
    for(int i = 1; i <= p ; i ++ ){
        for(int j = 1; j <= m; j ++ ){
            for(int t = j ; t >= 1; t -- ){
                dp[i][j] = min(dp[i][j], dp[i-1][t-1] + cat[j] * (j-t+1) - (pref[j] - pref[t - 1]));
            }
        }
    }
    cout << dp[p][m];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;
const ll inf = (ll) 4e18;

ll s[N];
ll cat[N];
ll pref[N];
ll dp[P][N];

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tm;
    for(int i = 1 ; i <= m ; i ++ ){
        cin >> id >> tm;
        cat[i] = s[id] - tm;
    }
    sort(cat + 1, cat + m + 1);
    for(int i = 1; i <= m; i ++ ){
        pref[i] = pref[i-1] + cat[i];
    }
    for(int i = 0; i < P; i ++ ) for (int j = 0 ; j < N ; j ++ ){
        dp[i][j] = inf;
    }
    dp[0][0] = 0;
    for(int i = 1; i <= p ; i ++ ){
        for(int j = 1; j <= m; j ++ ){
            for(int t = j ; t >= 1; t -- ){
                dp[i][j] = min(dp[i][j], dp[i-1][t-1] + cat[j] * (j-t+1) - (pref[j] - pref[t - 1]));
            }
        }
    }
    cout << dp[p][m];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
const int P = 101;
const ll inf = (ll) 4e18;

ll s[N];
ll cat[N];
ll pref[N];
ll dp[P][N];

struct Line{
    ll a;
    ll b;
    ll ps;
};

ll dv(ll x, ll y){
    return (x/y) - ((x^y)<0 && x%y != 0);
}

ll intersectx(Line A, Line B){
    return dv(A.b-B.b,B.a-A.a);
}

int main(){
    fastIO;
    int n, m, p;
    cin >> n >> m >> p;
    if(p > m){
        cout << 0;
        return 0;
    }
    for(int i = 2; i <= n; i ++ ){
        cin >> s[i];
        s[i] += s[i - 1];
    }
    int id;
    ll tm;
    for(int i = 1 ; i <= m ; i ++ ){
        cin >> id >> tm;
        cat[i] = tm - s[id];
    }
    sort(cat + 1, cat + m + 1);
    for(int i = 1; i <= m; i ++ ){
        pref[i] = pref[i-1] + cat[i];
    }
    for(int i = 0; i < P; i ++ ) for (int j = 0 ; j < N ; j ++ ){
        dp[i][j] = inf;
    }
    dp[0][0] = 0;
    Line cur;
    int sz;
    for(int i = 1; i <= p ; i ++ ){
        deque<Line> Hull;
        for(int j = 1; j <= m; j ++ ){
            cur.a = j;
            cur.b = -dp[i-1][j-1]-pref[j-1];
            cur.ps = inf;
            while(Hull.size() > 1){
                sz = Hull.size();
                if(Hull[sz - 2].ps >= intersectx(Hull[sz - 1], cur)){
                    Hull[sz - 2].ps = intersectx(Hull[sz - 2], cur);
                    Hull.pop_back();
                }
                else{
                    break;
                }
            }
            if(!Hull.empty()){
                sz = Hull.size();
                Hull[sz - 1].ps = intersectx(Hull[sz - 1], cur);
            }
            Hull.push_back(cur);
            while(Hull.front().ps < cat[j])
                Hull.pop_front();
            dp[i][j] = min(dp[i][j], -(cat[j] * Hull.front().a + Hull.front().b) + cat[j] * (j+1) - pref[j]);
        }
    }
    cout << dp[p][m];
    return 0;
}


/*
 *    author:  gantheory
 *    created: 2018-06-06 13:36:47
 */
#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

// Lower Convex Hull {{{
// m is decreasing
class LowerConvexHull {
 public:
  deque<pair<long long, long long>> dq;
  void Insert(long long m, long long b) {
    while ((int)dq.size() > 1) {
      int sz = dq.size();
      auto& l1 = dq[sz - 1];
      auto& l2 = dq[sz - 2];
      if ((b - l2.second) * (l2.first - l1.first) <
          (l1.second - l2.second) * (l2.first - m))
        dq.pop_back();
      else
        break;
    }
    dq.emplace_back(m, b);
  }
  long long Query(long long x) {
    assert(dq.empty() == false);
    while ((int)dq.size() > 1) {
      auto& l1 = dq[0];
      auto& l2 = dq[1];
      if ((l2.second - l1.second) < (l1.first - l2.first) * x)
        dq.pop_front();
      else
        break;
    }
    return dq.front().first * x + dq.front().second;
  }
  bool empty() { return dq.empty(); }
};
// }}}

long long n, m, p, d[N], h[N], t[N], dp[N][110];
LowerConvexHull hull[110];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.setf(ios::fixed), cout.precision(9);
  cin >> n >> m >> p;
  for (int i = 2; i <= n; ++i) cin >> d[i];
  for (int i = 1; i <= m; ++i) cin >> h[i] >> t[i];

  vector<long long> pd(n + 1);
  for (int i = 1; i <= n; ++i) pd[i] = pd[i - 1] + d[i];

  vector<long long> start_time(m + 1);
  for (int i = 1; i <= m; ++i) start_time[i] = t[i] - pd[h[i]];
  sort(start_time.begin() + 1, start_time.end());

  vector<long long> ps(m + 1);
  for (int i = 1; i <= m; ++i) ps[i] += ps[i - 1] + start_time[i];

  // dp[i][j]
  // = min_{k < i}(dp[k][j - 1]
  //               + \sum_{l = k + 1}^i start_time[i] - start_time[l])
  // = min_{k < i}(dp[k][j - 1] + (i - k) * start_time[i]
  //               - \sum_{l = k + 1}^i start_time[l])
  // = min_{k < i}(dp[k][j - 1] + (i - k) * start_time[i] - (ps[i] - ps[k]))
  // = min_{k < i}(dp[k][j - 1] - k * start_time[i] + i * start_time[i]
  //               - (ps[i] - ps[k])
  // = min_{k < i}((dp[k][j - 1] + ps[k]) - k * start_time[i]
  //               + i * start_time[i] - ps[i])

  for (int i = 1; i <= m; ++i)
    for (int j = 0; j <= p; ++j) dp[i][j] = LLONG_MAX;
  for (int i = 1; i <= m; ++i) dp[i][1] = i * start_time[i] - ps[i];
  for (int i = 1; i <= p; ++i) dp[1][i] = dp[1][1];

  for (long long i = 1; i <= m; ++i) {
    for (long long j = 1; j <= p; ++j) {
      if (hull[j - 1].empty()) continue;
      long long now =
          hull[j - 1].Query(start_time[i]) + i * start_time[i] - ps[i];
      dp[i][j] = min(dp[i][j], now);
    }
    for (long long j = 0; j <= p; ++j)
      if (dp[i][j] != LLONG_MAX) hull[j].Insert(-i, dp[i][j] + ps[i]);
  }
  cout << dp[m][p] << '\n';
}

// ntuj - bev9hb5x26poz33knumlo


/*input
4 6 2
1 3 5
1 0
2 1
4 9
1 10
2 10
3 12
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k)     for(int i = j ; i < k ; ++i)
#define RREP(i,j,k)    for(int i = j ; i >=k ; --i)
#define A    first
#define B    second
#define mp   make_pair
#define pb   emplace_back
#define PII pair<int , int>
#define MEM(i,j)   memset(i , j , sizeof i)
#define ALL(i)     i.begin() , i.end()
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie(0) , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
#define int long long
#define MAX 100900
#define INF 1e16

int n , m , k , x[MAX] , p[MAX] , d[MAX] , dp[MAX][110] , nowj;
int w(int s , int t){
	return dp[s][nowj - 1] - (p[t] - p[s]) + x[t] * (t - s);
}
int check(int q , int w , int e){
	int a1 = -q , b1 = dp[q][nowj - 1] + p[q];
	int a2 = -w , b2 = dp[w][nowj - 1] + p[w];
	int a3 = -e , b3 = dp[e][nowj - 1] + p[e];
	return (b1 - b2) / (a2 - a1) >= (b2 - b3) / (a3 - a2);
}
int32_t main(){
	IOS;
	cin >> n >> m >> k;
	REP(i , 2 , n + 1) cin >> d[i] , d[i] += d[i - 1];
	REP(i , 1 , m + 1){
		int a , b;
		cin >> a >> b;
		x[i] = b - d[a];
	}
	sort(x + 1 , x + 1 + m);
	// REP(i , 1 , m + 1) cout << x[i] << " "; cout << endl;
	REP(i , 1 , m + 1) p[i] = p[i - 1] + x[i];
	// REP(i , 1 , m + 1) cout << p[i] << " "; cout << endl;

	REP(j , 0 , k + 1) REP(i , 0 , m + 1) dp[i][j] = INF;
	dp[0][0] = 0;
	// REP(j , 1 , k + 1){
	// 	nowj = j;
	// 	REP(i , 1 , m + 1){
	// 		dp[i][j] = INF;
	// 		REP(T , 0 , i){
	// 			dp[i][j] = min(dp[i][j] , w(T , i));
	// 		}
	// 		DB4(i , j , " = " , dp[i][j]);
	// 	}
	// }
	REP(j , 1 , k + 1){
		nowj = j;
		deque<int> dq;
		dq.push_back(0);
		REP(i , 1 , m + 1){
			while(dq.size() >= 2 && w(dq[0] , i) >= w(dq[1] , i)) dq.pop_front();
			dp[i][j] = w(dq[0] , i);
			// DB4(i , j , dq[0] , dp[i][j]);
			while(dq.size() >= 2 && check(dq[dq.size() - 1] , dq[dq.size() - 2] , i))
				dq.pop_back();
			dq.push_back(i);
		}
	}
	int ans = dp[m][1];
	REP(i , 1 , k + 1) ans = min(ans , dp[m][i]);
	cout << ans << endl;
    return 0;
}
// ntuj - jb65awi4636n2h7koidsc


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII;
const double eps = 1e-12;
const double PI = acos(-1);
const LL INFF = (LL)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9+7;
const int MAX = (int)1e5+7;
int n, m, p;
LL dis[MAX];
LL a[MAX];
LL dp[MAX][101];
LL lsum[MAX];
void init(){
	scanf("%d %d %d", &n, &m, &p);
	if(p > m) p = m;
	rep1(i, 1, n) scanf("%lld", dis + i);
	rep1(i, 1, n) dis[i] += dis[i-1];
	rep1(i, 1, m+1){
		DRII(v, t);
		a[i] = t - dis[v-1];
	}
	sort(a + 1, a + m + 1);
	rep1(i, 1, m+1) lsum[i] = lsum[i-1] + a[i];
	dp[m][1] = a[m]*m - lsum[m];
	return ;
}
int ck[MAX];
void sol(){
	if(p == 1){
		printf("%lld\n", dp[m][1]); return ;
	}
	rep1(i, 1, m) dp[i][2] = dp[m][1] - (a[m] - a[i])*i;
	rep1(i, 3, p+1){
		int ll = 1, rr = 1;
		ck[1] = m-i+2;
		bool fg = 1;
		per1(j, m-i+1, 1){
			if(j != m-i+1 && fg) ck[++rr] = j+1;
			while(ll != rr){
				LL v1 = dp[ ck[rr] ][i-1] - a[ ck[rr] ]*j;
				LL v2 = dp[ ck[rr-1] ][i-1] - a[ ck[rr-1] ]*j;
				if(v1 <= v2) break;
				else{
					rr--;
					fg = 0;
				}
			}
			dp[j][i] = dp[ ck[rr] ][i-1] - a[ ck[rr] ]*j + a[j]*j;
		}
	}

	LL ans = INFF;
	rep1(i, 1, m-p+2) ans = min(ans, dp[i][p]);
	printf("%lld\n", ans);
	return ;
}
int main(void){
	init();
	sol();
	return 0;
}

// ntuj - 4kehw04m36k4goaclopkr


#include <cstdio>
#include <tuple>
#include <vector>
#include <algorithm>

using namespace std;

constexpr int MAXN = 1e5 + 10;
constexpr int MAXM = 1e5 + 10;
constexpr int MAXP = 100 + 10;

using LL = long long;

constexpr LL INF = 1LL << 61;

int n, m, p;

int xs[MAXN];

int ds[MAXM];
LL sumd[MAXM];

struct FUCK {
    LL m, k;
    LL operator () (LL x) const { return x*m + k; }
};

void fuck(LL dp[], const LL f[]) {
    static FUCK fucks[MAXM]; int lf = 0, rf = -1;
    fucks[++rf] = {0, f[0]};

    for (int i = 1; i <= m; ++i) {
        FUCK shit = {-i, f[i] + sumd[i]};
        LL now = shit(ds[i]);
        while (lf <= rf and fucks[rf](ds[i]) >= now) --rf;
        fucks[++rf] = shit;

        LL tmp = fucks[lf](ds[i]), tmp2;
        while (lf < rf and tmp >= (tmp2 = fucks[lf+1](ds[i])))
            tmp = tmp2, lf += 1;

        dp[i] = tmp + ds[i] * i - sumd[i];
    }
}

int main() {
    scanf("%d%d%d", &n, &m, &p);
    for (int i = 2; i <= n; ++i) {
        int d; scanf("%d", &d);
        xs[i] = xs[i-1] + d;
    }

    LL ans = 0;
    for (int i = 1; i <= m; ++i) {
        int xid, y; scanf("%d%d", &xid, &y);
        int x = xs[xid];
        if (y-x < 0) ans += x-y, y = x;
        ds[i] = y - x;
    }

    sort(ds+1, ds+m+1);
    for (int i = 1; i <= m; ++i) sumd[i] = sumd[i-1] + ds[i];

    static LL dp[MAXP][MAXN];
    fill_n(&dp[0][1], m, INF);
    for (int i = 1; i <= p; ++i) fuck(dp[i], dp[i-1]);

    printf("%lld\n", ans + dp[p][m]);

    return 0;
}

// ntuj - at7w1f26znw22jnu21r99


#include <cstdio>
#include <tuple>
#include <vector>
#include <algorithm>

using namespace std;

constexpr int MAXN = 1e5 + 10;
constexpr int MAXM = 1e5 + 10;
constexpr int MAXP = 100 + 10;

using LL = long long;

constexpr LL INF = 1LL << 61;

int n, m, p;

int xs[MAXN];

int ds[MAXM];
LL sumd[MAXM];

struct FUCK {
    LL m, k;
    LL operator () (LL x) const { return x*m + k; }
};

bool fuckoff(const FUCK &a, const FUCK &b, const FUCK &c) {
    return (c.k - a.k) * (a.m - b.m) <= (b.k - a.k) * (a.k - c.k);
}

void fuck(LL dp[], const LL f[]) {
    static FUCK fucks[MAXM]; int lf = 0, rf = -1;
    fucks[++rf] = {0, f[0]};

    for (int i = 1; i <= m; ++i) {
        FUCK shit = {-i, f[i] + sumd[i]};
        while (lf < rf and fuckoff(fucks[rf-1], fucks[rf], shit)) --rf;
        fucks[++rf] = shit;

        LL tmp = fucks[lf](ds[i]), tmp2;
        while (lf < rf and tmp >= (tmp2 = fucks[lf+1](ds[i])))
            tmp = tmp2, lf += 1;

        dp[i] = tmp + ds[i] * i - sumd[i];
    }
}

int main() {
    scanf("%d%d%d", &n, &m, &p);
    for (int i = 2; i <= n; ++i) {
        int d; scanf("%d", &d);
        xs[i] = xs[i-1] + d;
    }

    LL ans = 0;
    for (int i = 1; i <= m; ++i) {
        int xid, y; scanf("%d%d", &xid, &y);
        int x = xs[xid];
        ds[i] = y - x;
    }

    sort(ds+1, ds+m+1);
    for (int i = 1; i <= m; ++i) sumd[i] = sumd[i-1] + ds[i];

    static LL dp[2][MAXN], *a = dp[0], *b = dp[1];
    fill_n(&a[1], m, INF);
    for (int i = 1; i <= p; ++i) {
        fuck(b, a);
        swap(a, b);
    }

    printf("%lld\n", ans + a[m]);

    return 0;
}

// ntuj - cqn0p8sjd6tzrd7cx3ts3


#include <bits/stdc++.h>
#define ll long long
#define maxn 100005
using namespace std;

int n, m, p;
int h[maxn];
ll d[maxn], t[maxn], y[maxn];
ll sum[maxn];
ll dp[maxn][105]; //m*p

int q[maxn], head, tail;

ll getans(int i, int j, int k) { return dp[k][j - 1] + sum[k] - k * t[i] + i * t[i] - sum[i]; }

int main()
{
	cin >> n >> m >> p;
	for (int i = 2; i <= n; i++)
	{
		scanf("%lld", &d[i]);
		d[i] += d[i - 1];
	}
	for (int i = 1; i <= m; i++)
	{
		scanf("%d%lld", &h[i], &t[i]);
		t[i] -= d[h[i]];
	}
	sort(t + 1, t + m + 1);
	for (int i = 1; i <= m; i++)
	{
		sum[i] = sum[i - 1] + t[i];
		dp[i][1] = t[i] * i - sum[i];
	}
	for (int j = 2; j <= p; j++)
	{
		/* dp[i][j]=min( dp[k][j-1]+sum[k]  -k*t[i]   +i*t[i]-sum[i])  */
		head = tail = 0;
		q[head++] = 0;
		for (int i = 1; i <= m; i++)
		{
			while (head > tail + 1 && getans(i, j, q[tail]) > getans(i, j, q[tail + 1]))
				tail++;
			dp[i][j] = getans(i, j, q[tail]);
			y[i] = dp[i][j - 1] + sum[i];
			while (head > tail + 1 &&
				   (y[i] - y[q[head - 1]]) * (q[head - 1] - q[head - 2]) < (y[q[head - 1]] - y[q[head - 2]]) * (i - q[head - 1]))
				head--;
			q[head++] = i;
		}
	}
	printf("%lld\n", dp[m][p]);

	return 0;
}
// ntuj - k0w3ehovu6rg9w28i9ns


#include <cstdio>
#include <tuple>
#include <vector>
#include <algorithm>

using namespace std;

constexpr int MAXN = 1e5 + 10;
constexpr int MAXM = 1e5 + 10;
constexpr int MAXP = 100 + 10;

using LL = long long;

constexpr LL INF = 1LL << 61;

int n, m, p;

int xs[MAXN];

int ds[MAXM];
LL sumd[MAXM];

struct FUCK {
    LL m, k;
    LL operator () (LL x) const { return x*m + k; }
};

void fuck(LL dp[], const LL f[]) {
    static FUCK fucks[MAXM]; int lf = 0, rf = 0;
    fucks[rf++] = {0, f[0]};

    for (int i = 1; i <= m; ++i) {
        LL tmp = fucks[lf](ds[i]), tmp2;
        while (lf < rf and tmp >= (tmp2 = fucks[lf+1](ds[i])))
            tmp = tmp2, lf += 1;

        dp[i] = tmp + ds[i] * i - sumd[i];

        fucks[rf++] = {-i, f[i] + sumd[i]};
    }
}

int main() {
    scanf("%d%d%d", &n, &m, &p);
    for (int i = 2; i <= n; ++i) {
        int d;
        scanf("%d", &d);
        xs[i] = xs[i-1] + d;
    }

    LL ans = 0;
    for (int i = 0; i < m; ++i) {
        int xid, y; scanf("%d%d", &xid, &y);
        int x = xs[xid];
        if (y-x < 0) ans += x-y, y = x;
        ds[i] = y - x;
    }

    ds[m] = -1;
    sort(ds, ds+m+1);
    for (int i = 1; i <= m; ++i) sumd[i] = sumd[i-1] + ds[i];

    static LL dp[MAXP][MAXN];
    fill_n(&dp[0][1], m+2, INF);
    for (int i = 1; i <= p; ++i) fuck(dp[i], dp[i-1]);

    printf("%lld\n", ans + dp[p][m]);

    return 0;
}

// ntuj - dmqs133mzmph917t3a9wu


#include<bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef pair<int,int>par;
int d[100005];
int t[100005];
int st[100005],se=0,sb=0;
long long int dp[105][100005];
int main(){
    int n,m,p;
    scanf("%d%d%d",&n,&m,&p);
    for(int i=1;i<n;i++)
        scanf("%d",&d[i]),d[i]+=d[i-1];
    long long int sum=0;
    for(int i=0;i<m;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        t[i]=b+d[a];
        sum+=t[i];
    }
    sort(t,t+m);
    for(int j=0;j<m;j++)
        dp[0][j]=t[j]*(j+1);
    for(int i=1;i<p;i++){
        sb=se=0;
        st[se++]=0;
        dp[i][0]=t[0];
        for(int j=1;j<m;j++){
            dp[i][j]=0x7fffffffffffffffll;
            for(int k=0;k<j;k++)
                dp[i][j]=min(dp[i][j],dp[i-1][k] + t[j]*j - t[j]*k);
            continue;
            //dp[i][j] = min(dp[i-1][k]+t[j]*(j-k)) = min( dp[i-1][k] + t[j]*j - t[j]*k );
            while(se-sb>=2){
                int x=st[sb];
                int y=st[sb+1];
                if( dp[i-1][x]+t[j]*j-t[j]*x >= dp[i-1][y]+t[j]*j-t[j]*y )
                    sb++;
                else
                    break;
            }
            dp[i][j]=dp[i-1][st[sb]]+t[j]*j-t[j]*st[sb];
            printf("%d %d %lld\n",i,j,dp[i][j]);
            while(se-sb>=2){
                int x=st[se-2];
                int y=st[se-1];
                int z=i;
                if( double((-t[z])-(-t[x])) * double((dp[i-1][x])-(dp[i-1][y])) <= double((-t[y])-(-t[x])) * double((dp[i-1][x])-(dp[i-1][z])))
                    se--;
                else
                    break;
            }
            st[se++]=i;
        }
    }
    printf("%lld\n",dp[p-1][m-1]-sum);
    return 0;
}

// L1: a1 x + b1
// L2: a2 x + b2
// L3: a3 x + b3
//x(1, 3) = (b3 - b1) / (a1 - a3) < x(1, 2) = (b2 - b1) / (a1 - a2)

// ntuj - mg67pe5q5lhci3bfy6wo2


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define int long long

int m;
ll t[100005],pre[100005];
ll d[123456];
ll dp[105][100005];

struct line{
    int i;
    ll m,y;
    ll get(ld x){return m*x+y;}
};

ld inter(line l1,line l2){
    return (ld)(l1.y-l2.y)/(l2.m-l1.m);
}

main(){
    int n,p; cin>>n>>m>>p;
    for(int i=2;i<=n;++i)cin>>d[i];
    for(int i=3;i<=n;++i)d[i]+=d[i-1];
    for(int i=1;i<=m;++i){
        int h; ll tt; cin>>h>>tt;
        t[i]=tt-d[h];
    }
    sort(t+1,t+m+1);
    for(int i=1;i<=m;++i)pre[i]=pre[i-1]+t[i];
    // cout<<"t: "; for(int i=1;i<=m;++i)cout<<t[i]<<" "; cout<<endl;

    for(int i=1;i<=m;++i)dp[1][i]=t[i]*i-pre[i];
    for(int i=2;i<=p;++i){
        deque<line> q; q.push_back({0,0,0});
        for(int j=1;j<=m;++j){
            while(q.size()>1 && q[0].get(t[j])>=q[1].get(t[j]))q.pop_front();
            dp[i][j]=t[j]*j-pre[j]+q[0].get(t[j]);
            line nline={j,-j,dp[i-1][j]+pre[j]};
            while(q.size()>1 && inter(nline,q[q.size()-2])<=inter(q[q.size()-2],q.back()))q.pop_back();
            q.push_back(nline);
        }
    }

    /* for(int i=1;i<=p;++i){
        for(int j=1;j<=m;++j){
            cout<<dp[i][j]<<" ";
        } cout<<endl;
    } */

    cout<<dp[p][m]<<endl;
}

// ntuj - o4dexfhrj9dr5q8gqc6n1


#include<bits/stdc++.h>
#define PUB push_back
#define PUF push_front
#define POB pop_back
#define POF pop_front
#define SZ(x) (int)x.size()
using namespace std;
typedef long long LL;
const LL maxn=100000+5;
const LL maxm=100000+5;
const LL maxp=100+5;
const LL INF= 1<<30;
template<typename T>inline bool getmin(T& a,const T& b) {return b < a ? (a=b,true):false;}
LL pre[maxn],cat[maxm];
LL dp[maxm][maxp];
struct Line
{
    LL slope,inter;
    inline LL getval(LL x) {return slope*x+inter;}
};
inline double IntersecX(Line A,Line B)
{
    return (double) (A.inter-B.inter)/(B.slope-A.slope);
}
inline LL Getdp(LL i,deque<Line>& dq)
{
    while(SZ(dq)>=2 && dq[0].getval(cat[i]) > dq[1].getval(cat[i])) dq.POF();
    //printf("GetLine(%lld %lld)\n",dq[0].slope,dq[0].inter);
    LL ans = dq[0].getval(cat[i]) + i*cat[i] - pre[i];
    return ans;
}
inline void Insdp(LL slope,LL inter,deque<Line>& dq)
{
    Line now = (Line){slope,inter};
    while(SZ(dq)>=2 && IntersecX(dq[SZ(dq)-1],dq[SZ(dq)-2]) > IntersecX(dq[SZ(dq)-2],now)) dq.POB();
    //printf("InsertLine(%lld,%lld)\n",now.slope,now.inter);
    dq.PUB(now);
}
deque<Line> dq[maxp];
int main()
{
    LL n,m,p;
    scanf("%lld%lld%lld",&n,&m,&p);
    for(LL i=2,x;i<=n;i++)
    {
        scanf("%lld",&x);
        pre[i]=pre[i-1]+x;
    }
    for(LL i=1,x,t;i<=m;i++)
    {
        scanf("%lld%lld",&x,&t);
        cat[i]=t-pre[x];
        //printf("cat[%lld]=%lld\n",i,cat[i]);
    }
    sort(cat+1,cat+m+1);

    for(LL i=1;i<=m;i++)
    {
        //printf("cat[%lld]=%lld\n",i,cat[i]);
        pre[i]=pre[i-1]+cat[i];
    }
    for(LL i=1;i<=n;i++) for(LL j=0;j<=p;j++) dp[i][j]=INF;
    dp[0][0]=0;
    dq[0].PUB((Line){-0,dp[0][0]+pre[0]});
    for(LL i=1;i<=m;i++)
        for(LL j=1;j<=p;j++)
        {
            dp[i][j] = Getdp(i,dq[j-1]);
            Insdp(-i,pre[i]+dp[i][j],dq[j]);
            //printf("dp[%lld][%lld]=%lld\n",i,j,dp[i][j]);
        }
    printf("%lld\n",dp[m][p]);
}

// ntuj - 87v3my54xwwrlqogeb2fj


#include<bits/stdc++.h>

using namespace std;

typedef long long LL;

#define NN 100001

int n, m, p, q[NN];
LL a[NN], d[NN], s[NN], dp[2][NN];

inline LL ff(bool prv, int j) {
    return dp[prv][j]+s[j];
}
inline bool cmp(bool prv, int oo, int aa, int bb) {
    LL an = ff(prv, aa) - ff(prv, oo);
    LL bn = ff(prv, bb) - ff(prv, oo);
    return bn*(aa-oo) >= an*(bb-oo);
}
int main() {
    scanf("%d %d %d", &n, &m, &p);
    for(int i = 2; i<=n; ++i) {
        scanf("%lld", d+i);
        d[i] += d[i-1];
    }
    for(int i = 1; i<=m; ++i) {
        int h; scanf("%d %lld", &h, a+i);
        a[i] -= d[h];
    }
    sort(a+1, a+m+1);
    for(int i = 1; i<=m; ++i) s[i] = (s[i-1]+a[i]);
    for(int i = 1; i<=m; ++i) dp[0][i] = i*a[i]-s[i];
    bool prv = 0, now = 1;
    for(int i = 2; i<=p; ++i) {
        int p1 = 0, p2 = 0;
        q[0] = 0;
        for(int j = 1; j<=m; ++j) {
            while( p1<p2 && cmp(prv, q[p2], q[p2-1], j) ) --p2;
            q[++p2] = j;
            while( p1<p2 && a[j]*(q[p1+1]-q[p1]) >= (ff(prv, q[p1+1])-ff(prv, q[p1])) )
                ++p1;
            dp[now][j] = dp[prv][q[p1]]+a[j]*(j-q[p1])-s[j]+s[q[p1]];
        }
        swap(prv, now);
    }
    printf("%lld\n", dp[prv][m]);
}

// ntuj - 81havon621k5fagnv63tv


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MAXP 101
#define MAXN 100001

int n, m, p;
int d[MAXN];

typedef long long ll;
typedef pair<ll, ll> xy;
#define x first
#define y second

ll dp[MAXP][MAXN];
vector<int> v;

double operator^(xy a, xy b)
{
    return (double)a.x*b.y-(double)a.y*b.x;
}

xy operator-(xy a, xy b)
{
    return xy(a.x-b.x, a.y-b.y);
}

ll cost(xy p, int a)
{
    return p.x+p.y*a;
}

int main()
{
    scanf("%d%d%d", &n, &m, &p);

    for (int ni = 2; ni <= n; ni++)
        scanf("%d", &d[ni]);

    for (int ni = 2; ni <= n; ni++)
        d[ni] += d[ni-1];

    ll sum = 0;

    for (int mi = 0; mi < m; mi++) {
        int h, t;
        scanf("%d%d", &h, &t);

        v.push_back(t-d[h]);
        sum += t-d[h];
    }

    sort(v.begin(), v.end());

    for (int pi = 1; pi <= p; pi++) {
        deque<xy> d;
        #define dn d.size()
        d.push_back(xy(0, 1) );

        for (int mi = 0; mi < m; mi++) {
            while (dn>=2 && cost(d[0], v[mi])>cost(d[1], v[mi]))
                d.pop_front();

            dp[pi][mi] = cost(d[0], v[mi])+v[mi]*mi;
            xy p = xy(dp[pi-1][mi], -mi);

            while (d.size()>=2 && ((p-d[dn-1])^(d[dn-1]-d[dn-2])) > 0)
                d.pop_back();

            if (pi > 1)
                d.push_back(p);
        }
    }

    ll ans = dp[p][m-1]-sum;
    printf("%lld\n", ans);
}

// ntuj - ingomaunjzqdye0hvemqs


//hi
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long int LL;
LL d[10005];
LL a[100005], b[100005];
LL dp[2][100005];
deque<int> dq;
int main(void){
    int n,m,p;
    scanf("%d%d%d",&n,&m,&p);
    int i;
    for(i=2;i<=n;i++) scanf("%lld",&d[i]);
    for(i=3;i<=n;i++) d[i]+=d[i-1];
    for(i=1;i<=m;i++){
		int h,t;
		scanf("%d%d",&h,&t);
		a[i]=-d[h]+t;
	}
	sort(a+1, a+1+m);
	for(i=1;i<=m;i++) b[i]=b[i-1]+a[i];
	int f=0;
	for(i=1;i<=m;i++) if(a[i]>=0) break;
	for(i=1;i<=m; i++){
		dp[f][i]=a[i]*i-b[i];
	}
	f=1-f;
	for(int j=2;j<=p;j++){
		dp[f][1]=b[1];
		dq.clear();
		dq.push_back(1);
		for(i=2;i<=m;i++){
			while(dq.size()>1){
				int x=dq.at(0);
				int y=dq.at(1);
				if( double((dp[1-f][y]+b[y])-(dp[1-f][x]+b[x]))/(y-x) <=a[i] ) dq.pop_front();
				else break;
			}
			int x=dq.at(0);
			dp[f][i] = dp[1-f][x]+a[i]*(i-x)-(b[i]-b[x]);
			while(dq.size()>1){
				int sz=dq.size();
				int x=dq.at(sz-1);
				int y=dq.at(sz-2);
				if( double((dp[1-f][i]+b[i])-(dp[1-f][x]+b[x]))/(i-x) <= double((dp[1-f][x]+b[x])-(dp[1-f][y]+b[y]))/(x-y) ) dq.pop_back();
				else break;
			}
			dq.push_back(i);
		}
		f=1-f;
	}
	printf("%lld\n",dp[1-f][m]);
    return 0;
}

// ntuj - 7rphs1m3jsj03xhopxkiu


#include<bits/stdc++.h>
using namespace std;
long long d[100010],h[100010],t[100010],Time[100010],pre[100010];
long long dp[100010][110];
int main(){
	ios::sync_with_stdio(false);
	int n,m,p;
	cin>>n>>m>>p;
	d[1]=0;
	for(int i=2;i<=n;i++){
		int a;
		cin>>a;
		d[i]=d[i-1]+a;
	}
	for(int i=1;i<=m;i++){
		cin>>h[i]>>t[i];
	}
	for(int i=1;i<=m;i++){
		Time[i]=t[i]-d[h[i]];
	}
	//for(int i=1;i<=m;i++) cout<<Time[i]<<" ";
	//cout<<endl;
	sort(Time+1,Time+m+1);
	long long total=0;
	/*for(int i=1;i<=m;i++) {
		if(Time[i]<0){
			total-=Time[i];
			Time[i]=0;
		}
	}*/
	for(int i=1;i<=m;i++) pre[i]=pre[i-1]+Time[i];
	for(int i=1;i<=p;i++){
		if(i==1){
			for(int j=1;j<=m;j++){
				dp[j][1]=Time[j]*j-pre[j];
			}
		}
		else{

			int now=1;
			for(int j=2;j<=m;j++){
				while(1){
					if(now==j||dp[now][i-1]+Time[j]*(j-now)-(pre[j]-pre[now])<dp[now+1][i-1]+Time[j]*(j-now+1)-(pre[j]-pre[now+1])) break;
					now++;
				}
				dp[j][i]=dp[now][i-1]+Time[j]*(j-now)-(pre[j]-pre[now]);
			}

		}
	}
	/*for(int i=1;i<=m;i++){
		for(int j=1;j<=p;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/
	cout<<dp[m][p]+total<<endl;

}

// ntuj - nxmz0twiwbutwwkyvlp1a


#include<bits/stdc++.h>
using namespace std;
long long d[100010],h[100010],t[100010],Time[100010],pre[100010];
long long dp[100010][110];
int main(){
	ios::sync_with_stdio(false);
	int n,m,p;
	cin>>n>>m>>p;
	d[1]=0;
	for(int i=2;i<=n;i++){
		int a;
		cin>>a;
		d[i]=d[i-1]+a;
	}
	for(int i=1;i<=m;i++){
		cin>>h[i]>>t[i];
	}
	for(int i=1;i<=m;i++){
		Time[i]=t[i]-d[h[i]];
	}
	//for(int i=1;i<=m;i++) cout<<Time[i]<<" ";
	//cout<<endl;
	sort(Time+1,Time+m+1);
	int total=0;
	for(int i=1;i<=m;i++) {
		if(Time[i]<0){
			total-=Time[i];
			Time[i]=0;
		}
	}
	for(int i=1;i<=m;i++) pre[i]=pre[i-1]+Time[i];
	for(int i=1;i<=p;i++){
		if(i==1){
			for(int j=1;j<=m;j++){
				dp[j][1]=Time[j]*j-pre[j];
			}
		}
		else{

			int now=1;
			for(int j=2;j<=m;j++){
				while(1){
					if(now==j||dp[now][i-1]+Time[j]*(j-now)-(pre[j]-pre[now])<dp[now+1][i-1]+Time[j]*(j-now+1)-(pre[j]-pre[now+1])) break;
					now++;
				}
				dp[j][i]=dp[now][i-1]+Time[j]*(j-now)-(pre[j]-pre[now]);
			}

		}
	}
	/*for(int i=1;i<=m;i++){
		for(int j=1;j<=p;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/
	cout<<dp[m][p]<<endl;

}

// ntuj - du2uq8u65gh68a121w3l5


#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
    #define debug(...) printf(__VA_ARGS__)
#else
    #define debug(...) (void)0
#endif
#define mp make_pair
#define pb push_back
#define LL long long
#define pii pair<int,int>
#define PII pair<long long, long long>
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
const int inf = 0x7fffffff; //beware overflow
const LL INF = 0x7fffffffffffffff; //beware overflow
#define mem(x, y) memset(x, (y), sizeof(x) );
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A,B> &p) {
     return s<<"("<<p.first<<","<<p.second<<")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
    s << "[ ";
    for (auto it : c) s << it << " ";
    s << "]";
    return s;
}
template<typename T>
ostream& operator << (ostream &o, const set<T> &st) {
    o << "{";
    for (auto it=st.begin(); it!=st.end(); it++) o << (it==st.begin() ? "" : ", ") << *it;
    return o << "}";
}
template<typename T1, typename T2>
ostream& operator << (ostream &o, const map<T1, T2> &mp) {
    o << "{";
    for (auto it=mp.begin(); it!=mp.end(); it++) {
        o << (it==mp.begin()?"":", ") << it->fi << ":" << it->se;
    }
    o << "}";
    return o;
}
inline LL getint(){
   LL _x=0,_tmp=1; char _tc=getchar();
   while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
   if( _tc == '-' ) _tc=getchar() , _tmp = -1;
   while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
   return _x*_tmp;
}
struct line{
    LL slope, inter;
    LL value(LL x) { return x*slope + inter; }
};
bool check(line x, line y, line z) {
    return (z.slope - y.slope) * (z.inter - x.inter ) >=
           ( z.slope - x.slope) * (z.inter - y.inter) ;
}

#define maxn 100005
int n, m, p;
LL a[maxn], d[maxn], dp[101][maxn], s[maxn];
int main() {
    cin>> n >> m >> p;
    for(int i = 2; i<=n; ++i) {
        d[i] = getint();
        d[i] += d[i-1];
    }
    for(int i = 1; i<=m; ++i) {
        int h; scanf("%d %lld", &h, a+i);
        a[i] -= d[h];
    }
    sort( a+1, a+1+m );
    for(int i=1;i<=m;i++) s[i] = a[i]+s[i-1];
    //start dp
    for(int i=1; i<=p;i++) {
        if( i == 1 ) {
            for(int j=1;j<=m;j++) dp[i][j] = j*a[j] - s[j];
        }else {
            deque<line> dq;
            dq.pb( {0, 0} );
            for(int j=1;j<=m;j++) {
                while( dq.size() >= 2 && dq[0].value(-a[j]) > dq[1].value(-a[j]) ) dq.pop_front();
                dp[i][j] = dq[0].value(-a[j]);

                line newline{ j, dp[i-1][j]+s[j] };
                while( dq.size() >= 2 && check(dq[dq.size()-2], dq.back(), newline) ) dq.pop_back();
                dq.pb( newline );
            /*
                if( i==1 ) {
                    dp[i][j] = j*a[j] - s[j];
                }else {
                    LL mn = 0;
                    for(int k = 1; k < j; k++) {
                        mn = min(mn, dp[i-1][k] + s[k] - a[j]*k );
                    }
                    dp[i][j] = mn + a[j]*j-s[j];
                    // apply convex hull optimization
                }
            */
                dp[i][j] += a[j]*j - s[j];
            }
        }
    }
    cout << dp[p][m] << endl;
}

// ntuj - kkn76mqr20zdmc295mfn3


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII;
const double eps = 1e-12;
const double PI = acos(-1);
const LL INFF = (LL)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9+7;
const int MAX = (int)1e5+7;
int n, m, p;
LL dis[MAX];
LL a[MAX];
LL dp[MAX][101];
LL lsum[MAX];
void init(){
	scanf("%d %d %d", &n, &m, &p);
	if(p > m) p = m;
	rep1(i, 1, n) scanf("%lld", dis + i);
	rep1(i, 1, n) dis[i] += dis[i-1];
	rep1(i, 1, m+1){
		DRII(v, t);
		a[i] = t - dis[v-1];
	}
	sort(a + 1, a + m + 1);
	rep1(i, 1, m+1) lsum[i] = lsum[i-1] + a[i];
	dp[m][1] = a[m]*m - lsum[m];
	return ;
}
int ck[MAX];
LL cost[MAX];
void sol(){
	if(p == 1){
		printf("%lld\n", dp[m][1]); return ;
	}
	rep1(i, 1, m) dp[i][2] = dp[m][1] - (a[m] - a[i])*i;
	rep1(i, 3, p+1){
		int ll = 1, rr = 1;
		ck[1] = m-i+1;
		bool fg = 1;
		per1(j, m-i, 1){
			if(j != m-i && fg) ck[++rr] = i+1;
			while(ll != rr){
				LL v1 = dp[ ck[rr] ][i-1] - a[ ck[rr] ]*j;
				LL v2 = dp[ ck[rr-1] ][i-1] - a[ ck[rr-1] ]*j;
				if(v1 <= v2) break;
				else{
					rr--;
					fg = 0;
				}
			}
			dp[j][i] = dp[ ck[rr] ][i-1] - a[ ck[rr] ]*j + a[j]*j;
		}
	}

	LL ans = INFF;
	rep1(i, 1, m+2-p) ans = min(ans, dp[i][p]);
	printf("%lld\n", ans);
	return ;
}
int main(void){
	init();
	sol();
	return 0;
}

// ntuj - em2ldz01zq3pt8oojol5d


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MAXP 201
#define MAXN 200001

int n, m, p;
int d[MAXN];

typedef long long ll;
typedef pair<ll, ll> xy;
#define x first
#define y second

ll dp[MAXP][MAXN];
vector<int> v, w;
int cnt[MAXN];

double operator^(xy a, xy b)
{
    return (double)a.x*b.y-(double)a.y*b.x;
}

xy operator-(xy a, xy b)
{
    return xy(a.x-b.x, a.y-b.y);
}

ll cost(xy p, int a)
{
    return p.x+p.y*a;
}

int main()
{
    scanf("%d%d%d", &n, &m, &p);

    for (int ni = 2; ni <= n; ni++)
        scanf("%d", &d[ni]);

    for (int ni = 2; ni <= n; ni++)
        d[ni] += d[ni-1];

    ll sum = 0;

    for (int mi = 0; mi < m; mi++) {
        int h, t;
        scanf("%d%d", &h, &t);

        v.push_back(t-d[h]);
        sum += t-d[h];
    }

    sort(v.begin(), v.end());

    for (int pi = 1; pi <= p; pi++) {
        deque<xy> d;
        #define dn d.size()
        d.push_back(xy(0, 1) );

        for (int mi = 0; mi < m; mi++) {
            while (dn>=2 && cost(d[0], v[mi])>cost(d[1], v[mi]))
                d.pop_front();

            dp[pi][mi] = cost(d[0], v[mi])+v[mi]*mi;
            xy p = xy(dp[pi-1][mi], -mi);

            while (d.size()>=2 && ((p-d[dn-1])^(d[dn-1]-d[dn-2])) > 0)
                d.pop_back();

            if (pi > 1)
                d.push_back(p);
        }
    }

    ll ans = dp[p][m-1]-sum;
    printf("%lld\n", ans);
}

// ntuj - 8xznnjpt6sudcw44hwpuu


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII;
const double eps = 1e-12;
const double PI = acos(-1);
const LL INFF = (LL)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9+7;
const int MAX = (int)1e5+7;
int dis[MAX];
LL a[MAX];
LL lsum[MAX];
int n, m, p;
void init(){
	scanf("%d %d %d", &n, &m, &p);
	rep1(i, 1, n) scanf("%d", dis + i);
	rep1(i, 1, n) dis[i] += dis[i-1];
	rep1(i, 1, m+1){
		DRII(pos, t);
		a[i] = t - dis[pos-1];
	}
	sort(a + 1, a + m + 1);
	rep1(i, 1, m+1) lsum[i] = lsum[i-1] + a[i];
	return ;
}
LL dp[MAX][101];
int ck[MAX];
void sol(){
	if(p > m) p = m;
	rep1(i, 1, m+1) dp[i][1] = a[i]*i;
	rep1(i, 2, p+1){
		ck[1] = i-1;
		int ll = 1, rr = 1;
		rep1(j, i, m+1){
			while(ll != rr){
				LL v1 = dp[ ck[ll] ][i-1] + a[j]*(j-ck[ll]);
				LL v2 = dp[ ck[ll+1] ][i-1] + a[j]*(j-ck[ll+1]);
				if(v1 >= v2) ll++;
				else break;
			}
			dp[j][i] = dp[ ck[ll] ][i-1] + a[j]*(j-ck[ll]);
			while(ll != rr){
				LL d1 = dp[ ck[rr] ][i-1] - dp[ ck[rr-1] ][i-1];
				LL d2 = dp[j][i-1] - dp[ ck[rr] ][i-1];
				LL t1 = ck[rr] - ck[rr-1];
				LL t2 = j - ck[rr];
				if((LDB)d1*t2 >= (LDB)d2*t1) rr--;
				else break;
			}
			ck[++rr] = j;
		}

	}
	printf("%lld\n", dp[m][p] - lsum[m]);
	return ;
}
int main(void){
	init();
	sol();
	return 0;
}

// ntuj - nunjeccnbm96byw3ycgnq


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII;
const double eps = 1e-12;
const double PI = acos(-1);
const LL INFF = (LL)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9+7;
const int MAX = (int)1e5+7;
int n, m, p;
LL dis[MAX];
LL a[MAX];
LL dp[MAX][101];
LL lsum[MAX];
void init(){
	scanf("%d %d %d", &n, &m, &p);
	if(p > m) p = m;
	rep1(i, 1, n) scanf("%lld", dis + i);
	rep1(i, 1, n) dis[i] += dis[i-1];
	rep1(i, 1, m+1){
		DRII(v, t);
		a[i] = t - dis[v-1];
	}
	sort(a + 1, a + m + 1);
	rep1(i, 1, m+1) lsum[i] = lsum[i-1] + a[i];
	dp[m][1] = a[m]*m - lsum[m];
	return ;
}
int ck[MAX];
void sol(){
	if(p == 1){
		printf("%lld\n", dp[m][1]); return ;
	}
	rep1(i, 1, m) dp[i][2] = dp[m][1] - (a[m] - a[i])*i;
	rep1(i, 3, p+1){
		int ll = 1, rr = 1;
		ck[1] = m-i+2;
		bool fg = 1;
		per1(j, m-i+1, 1){
			if(j != m-i+1 && fg) ck[++rr] = j+1;
			while(ll != rr){
				LL v1 = dp[ ck[rr] ][i-1] - a[ ck[rr] ]*j;
				LL v2 = dp[ ck[rr-1] ][i-1] - a[ ck[rr-1] ]*j;
				if(v1 < v2) break;
				else{
					rr--;
					fg = 0;
				}
			}
			dp[j][i] = dp[ ck[rr] ][i-1] - a[ ck[rr] ]*j + a[j]*j;
		}
	}

	LL ans = INFF;
	rep1(i, 1, m-p+2) ans = min(ans, dp[i][p]);
	printf("%lld\n", ans);
	return ;
}
int main(void){
	init();
	sol();
	return 0;
}

// ntuj - iwlgh0jw777t7h7ni3len


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII;
const double eps = 1e-12;
const double PI = acos(-1);
const LL INFF = (LL)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9+7;
const int MAX = (int)1e5+7;
int n, m, p;
LL dis[MAX];
LL a[MAX];
LL dp[MAX][101];
LL lsum[MAX];
void init(){
	scanf("%d %d %d", &n, &m, &p);
	if(p > m) p = m;
	rep1(i, 1, n) scanf("%lld", dis + i);
	rep1(i, 1, n) dis[i] += dis[i-1];
	rep1(i, 1, m+1){
		DRII(v, t);
		a[i] = t - dis[v-1];
	}
	sort(a + 1, a + m + 1);
	rep1(i, 1, m+1) lsum[i] = lsum[i-1] + a[i];
	dp[m][1] = a[m]*m - lsum[m];
	return ;
}
int ck[MAX];
LL cost[MAX];
void sol(){
	if(p == 1){
		printf("%lld\n", dp[m][1]); return ;
	}
	rep1(i, 1, m) dp[i][2] = dp[m][1] - (a[m] - a[i])*i;
	rep1(i, 3, p+1){
		int ll = 1, rr = 1;
		ck[1] = m-i+2;
		bool fg = 1;
		per1(j, m-i+1, 1){
			if(j != m-i+1 && fg) ck[++rr] = i+1;
			while(ll != rr){
				LL v1 = dp[ ck[rr] ][i-1] - a[ ck[rr] ]*j;
				LL v2 = dp[ ck[rr-1] ][i-1] - a[ ck[rr-1] ]*j;
				if(v1 <= v2) break;
				else{
					rr--;
					fg = 0;
				}
			}
			dp[j][i] = dp[ ck[rr] ][i-1] - a[ ck[rr] ]*j + a[j]*j;
		}
	}

	LL ans = INFF;
	rep1(i, 1, m-p+2) ans = min(ans, dp[i][p]);
	printf("%lld\n", ans);
	return ;
}
int main(void){
	init();
	sol();
	return 0;
}

// ntuj - jwlc2fe6fk4ktov63k6dp


#include <cstdio>
#include <tuple>
#include <vector>
#include <algorithm>

using namespace std;

constexpr int MAXN = 1e5 + 10;
constexpr int MAXM = 1e5 + 10;
constexpr int MAXP = 100 + 10;

using LL = long long;

constexpr LL INF = 1LL << 61;

int n, m, p;

LL ds[MAXM];
LL sumd[MAXM];

struct FUCK {
    LL m, k;
    LL operator () (LL x) const { return x*m + k; }
};

bool fuckoff(const FUCK &a, const FUCK &b, const FUCK &c) {
    return (c.k - a.k) * (a.m - b.m) <= (b.k - a.k) * (a.m - c.m);
}

void fuck(LL dp[], const LL f[]) {
    static FUCK fucks[MAXM]; int lf = 0, rf = -1;
    fucks[++rf] = {0, f[0]};

    for (int i = 1; i <= m; ++i) {
        FUCK shit = {-i, f[i] + sumd[i]};
        while (lf < rf and fuckoff(fucks[rf-1], fucks[rf], shit)) --rf;
        fucks[++rf] = shit;

        LL tmp = fucks[lf](ds[i]), tmp2;
        while (lf < rf and tmp >= (tmp2 = fucks[lf+1](ds[i])))
            tmp = tmp2, lf += 1;

        dp[i] = tmp + ds[i] * i - sumd[i];
    }
}

int main() {
    scanf("%d%d%d", &n, &m, &p);

    static LL xs[MAXN];
    for (int i = 2; i <= n; ++i) {
        int d; scanf("%d", &d);
        xs[i] = xs[i-1] + d;
    }

    for (int i = 1; i <= m; ++i) {
        LL xid, y; scanf("%lld%lld", &xid, &y);
        LL x = xs[xid];
        ds[i] = y - x;
    }

    sort(ds+1, ds+m+1);
    for (int i = 1; i <= m; ++i) sumd[i] = sumd[i-1] + ds[i];

    static LL dp[2][MAXM], *a = dp[0], *b = dp[1];
    fill_n(&a[1], m, INF);
    for (int i = 1; i <= p; ++i) {
        fuck(b, a);
        swap(a, b);
    }

    printf("%lld\n", a[m]);

    return 0;
}

// ntuj - dflwwvqbm455cpe9tk093


//hi
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long int LL;
LL d[100005];
LL a[100005], b[100005];
LL dp[2][100005];
deque<int> dq;
int main(void){
    int n,m,p;
    scanf("%d%d%d",&n,&m,&p);
    int i;
    for(i=2;i<=n;i++) scanf("%lld",&d[i]);
    for(i=3;i<=n;i++) d[i]+=d[i-1];
    for(i=1;i<=m;i++){
		int h,t;
		scanf("%d%d",&h,&t);
		a[i]=-d[h]+t;
	}
	sort(a+1, a+1+m);
	for(i=1;i<=m;i++) b[i]=b[i-1]+a[i];
	int f=0;
	for(i=1;i<=m;i++) if(a[i]>=0) break;
	for(i=1;i<=m; i++){
		dp[f][i]=a[i]*i-b[i];
	}
	f=1-f;
	for(int j=2;j<=p;j++){
		dq.clear();
		dq.push_back(0);
		for(i=1;i<=m;i++){
			while(dq.size()>1){
				int x=dq.at(0);
				int y=dq.at(1);
				if( dp[1-f][y]+b[y]-a[i]*y <= dp[1-f][x]+b[x]-a[i]*x ) dq.pop_front();
				else break;
			}
			int x=dq.at(0);
			dp[f][i] = dp[1-f][x]+a[i]*(i-x)-(b[i]-b[x]);
			while(dq.size()>1){
				int sz=dq.size();
				int x=dq.at(sz-1);
				int y=dq.at(sz-2);
				if( ((dp[1-f][i]+b[i])-(dp[1-f][x]+b[x]))*(x-y) <= ((dp[1-f][x]+b[x])-(dp[1-f][y]+b[y]))*(i-x) ) dq.pop_back();
				else break;
			}
			dq.push_back(i);
		}
		f=1-f;
	}
	printf("%lld\n",dp[1-f][m]);
    return 0;
}

// ntuj - 5vw9uh8od0wwauqzve8nd


// run: $exec < bfdiff.in
// opt: 0
// flag: -g
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;

long long coord_y(int i, int p) { return f[i][p] + sum[i]; }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                          | this <= change to < will wa, because of the
	//                                          v zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) <= slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1; i < n; i++) { std::cin >> sum[i]; sum[i] += sum[i - 1]; }
	for (int i = 0; i < m; i++) {
		std::cin >> hill[i] >> tim[i];
		auto tmp = sum[hill[i] - 1];
		a[i + 1] = tim[i] - tmp;
	}
	std::sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++) sum[i] = sum[i - 1] + a[i];
	for (int i = 0; i <= p; i++) head[i] = tail[i] = 1;

	for (int i = 1; i <= m; i++)
		for (int j = p; j >= 1; j--) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

	std::cout << f[m][p] << '\n';
}


// run: $exec < bfdiff.in
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;

long long coord_y(int i, int p) { return f[i][p] + sum[i]; }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                          | this <= change to < will wa, because of the
	//                                          v zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) <= slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1; i < n; i++) { std::cin >> sum[i]; sum[i] += sum[i - 1]; }
	std::sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++) sum[i] = sum[i - 1] + a[i];
	for (int i = 0; i <= p; i++) head[i] = tail[i] = 1;

	for (int i = 1; i <= m; i++)
		for (int j = p; j >= 1; j--) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

	std::cout << f[m][p] + ans << '\n';
}


// run: $exec < bfdiff.in
// opt: 0
// flag: -g
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;

long long coord_y(int i, int p) { return f[i][p] + sum[i]; }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                          | this <= change to < will wa, because of the
	//                                          v zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) <= slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1; i < n; i++) { std::cin >> sum[i]; sum[i] += sum[i - 1]; }
	for (int i = 0; i < m; i++) {
		std::cin >> hill[i] >> tim[i];
		auto tmp = sum[hill[i] - 1];
		a[i + 1] = tim[i] - tmp;
	}
	std::sort(a + 1, a + m + 1);
	auto t = a[1];
	for (int i = 1; i <= m; i++) a[i] -= t;
	for (int i = 1; i <= m; i++) sum[i] = sum[i - 1] + a[i];
	for (int i = 0; i <= p; i++) head[i] = tail[i] = 1;

	for (int i = 1; i <= m; i++)
		for (int j = p; j >= 1; j--) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

	std::cout << f[m][p] << '\n';
}


// run: $exec < input
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;
long long ans;

long long coord_y(int i, int p) { return f[i][p] + (!i ? 0 : sum[i - 1]); }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                       |
	//                                       v this <= change to < will wa, because of the zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) <= slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1, x; i < n; i++) {
		std::cin >> x;
		sum[i] = sum[i - 1] + x;
	}
	for (int i = 0; i < m; i++) {
		std::cin >> hill[i] >> tim[i];
		auto tmp = sum[hill[i] - 1];
		if (tim[i] < tmp) {
			ans += tmp - tim[i];
			a[i + 1] = 0;
		} else
			a[i + 1] = tim[i] - tmp;
	}
	std::sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++)
		sum[i] = sum[i - 1] + a[i];

	for (int i = 0; i <= p; i++) {
		head[i] = tail[i] = 1;
		q[i][head[i]] = 0;
	}

	for (int i = 1; i <= m; i++)
		for (int j = 1; j <= p; j++) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

#ifdef __DEBUG
	for (int i = 1; i <= m; i++) std::cout << a[i] << ' ';
	std::cout << '\n';
	std::cout << '\n';
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= p; j++) std::cout << f[i][j] << ' ';
		std::cout << '\n';
	}
	std::cout << '\n';
#endif

	std::cout << f[m][p] + ans << '\n';
}


// run: $exec < bfdiff.in
// opt: 0
// flag: -g
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;

long long coord_y(int i, int p) { return f[i][p] + sum[i]; }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                          | this <= change to < will wa, because of the
	//                                          v zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) <= slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1; i < n; i++) {
		std::cin >> sum[i];
		sum[i] += sum[i - 1];
	}
	long long ans = 0;
	for (int i = 0; i < m; i++) {
		std::cin >> hill[i] >> tim[i];
		auto tmp = sum[hill[i] - 1];
		/*
		if (tim[i] < tmp) {
			ans += tmp - tim[i];
			a[i + 1] = 0;
		} else
			a[i + 1] = tim[i] - tmp;
		*/
		a[i + 1] = tim[i] - tmp;
	}
	std::sort(a + 1, a + m + 1);
	auto t = a[1];
	for (int i = 1; i <= m; i++) a[i] -= t;
	for (int i = 1; i <= m; i++)
		sum[i] = sum[i - 1] + a[i];

	for (int i = 0; i <= p; i++) {
		head[i] = tail[i] = 1;
		q[i][head[i]] = 0;
	}

	for (int i = 1; i <= m; i++)
		for (int j = p; j >= 1; j--) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

#ifdef __DEBUG
	for (int i = 1; i <= m; i++) std::cout << a[i] << ' ';
	std::cout << '\n';
	std::cout << '\n';
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= p; j++) std::cout << f[i][j] << ' ';
		std::cout << '\n';
	}
	std::cout << '\n';
#endif

	std::cout << f[m][p] + ans << '\n';
}


// run: $exec < input
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;
long long ans;

long long coord_y(int i, int p) { return f[i][p] + (!i ? 0 : sum[i - 1]); }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                       |
	//                                       v this <= change to < will wa, because of the zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) <= slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1, x; i < n; i++) {
		std::cin >> x;
		sum[i] = sum[i - 1] + x;
	}
	for (int i = 0; i < m; i++) {
		std::cin >> hill[i] >> tim[i];
		auto tmp = sum[hill[i] - 1];
		if (tim[i] < tmp) {
			ans += tmp - tim[i];
			a[i + 1] = 0;
		} else
			a[i + 1] = tim[i] - tmp;
	}
	std::sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++)
		sum[i] = sum[i - 1] + a[i];

	for (int i = 0; i <= p; i++) {
		head[i] = tail[i] = 1;
		q[i][head[i]] = 0;
	}

	for (int i = 1; i <= m; i++)
		for (int j = 1; j <= p; j++) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

#ifdef __DEBUG
	for (int i = 1; i <= m; i++) std::cout << a[i] << ' ';
	std::cout << '\n';
	std::cout << '\n';
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= p; j++) std::cout << f[i][j] << ' ';
		std::cout << '\n';
	}
	std::cout << '\n';
#endif

	std::cout << f[m][p] << '\n';
}


// run: $exec < input
// opt: 0
// flag: -g
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;

long long coord_y(int i, int p) { return f[i][p] + (!i ? 0 : sum[i - 1]); }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                          | this <= change to < will wa, because of the
	//                                          v zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) <= slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1; i < n; i++) {
		std::cin >> sum[i];
		sum[i] += sum[i - 1];
	}
	long long ans = 0;
	for (int i = 0; i < m; i++) {
		std::cin >> hill[i] >> tim[i];
		auto tmp = sum[hill[i] - 1];
		if (tim[i] < tmp) {
			ans += tmp - tim[i];
			a[i + 1] = 0;
		} else
			a[i + 1] = tim[i] - tmp;
	}
	std::sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++)
		sum[i] = sum[i - 1] + a[i];

	for (int i = 0; i <= p; i++) {
		head[i] = tail[i] = 1;
		q[i][head[i]] = 0;
	}

	for (int i = 1; i <= m; i++)
		for (int j = p; j >= 1; j--) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

#ifdef __DEBUG
	for (int i = 1; i <= m; i++) std::cout << a[i] << ' ';
	std::cout << '\n';
	std::cout << '\n';
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= p; j++) std::cout << f[i][j] << ' ';
		std::cout << '\n';
	}
	std::cout << '\n';
#endif

	std::cout << f[m][p] + ans << '\n';
}


// run: $exec < input
// opt: 0
// flag: -g
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;

long long coord_y(int i, int p) { return f[i][p] + (!i ? 0 : sum[i - 1]); }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                          | this <= change to < will wa, because of the
	//                                          v zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) <= slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1; i < n; i++) {
		std::cin >> sum[i];
		sum[i] += sum[i - 1];
	}
	long long ans = 0;
	for (int i = 0; i < m; i++) {
		std::cin >> hill[i] >> tim[i];
		auto tmp = sum[hill[i] - 1];
		if (tim[i] < tmp) {
			ans += tmp - tim[i];
			a[i + 1] = 0;
		} else
			a[i + 1] = tim[i] - tmp;
	}
	std::sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++)
		sum[i] = sum[i - 1] + a[i];

	for (int i = 0; i <= p; i++) {
		head[i] = tail[i] = 1;
		q[i][head[i]] = 0;
	}

	for (int i = 1; i <= m; i++)
		for (int j = 1; j <= p; j++) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && que[h + 1] < i && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

#ifdef __DEBUG
	for (int i = 1; i <= m; i++) std::cout << a[i] << ' ';
	std::cout << '\n';
	std::cout << '\n';
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= p; j++) std::cout << f[i][j] << ' ';
		std::cout << '\n';
	}
	std::cout << '\n';
#endif

	std::cout << f[m][p] + ans << '\n';
}


// run: $exec < bfdiff.in
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;

long long coord_y(int i, int p) { return f[i][p] + sum[i]; }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                          | this <= change to < will wa, because of the
	//                                          v zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) <= slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1; i < n; i++) { std::cin >> sum[i]; sum[i] += sum[i - 1]; }
	std::sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++) sum[i] = sum[i - 1] + a[i];
	for (int i = 0; i <= p; i++) head[i] = tail[i] = 1;

	for (int i = 1; i <= m; i++)
		for (int j = p; j >= 1; j--) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

	std::cout << f[m][p] << '\n';
}


// run: $exec < input
// opt: 0
// flag: -g
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;

long long coord_y(int i, int p) { return f[i][p] + (!i ? 0 : sum[i - 1]); }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                          | this <= change to < will wa, because of the
	//                                          v zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) < slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1; i < n; i++) {
		std::cin >> sum[i];
		sum[i] += sum[i - 1];
	}
	long long ans = 0;
	for (int i = 0; i < m; i++) {
		std::cin >> hill[i] >> tim[i];
		auto tmp = sum[hill[i] - 1];
		if (tim[i] < tmp) {
			ans += tmp - tim[i];
			a[i + 1] = 0;
		} else
			a[i + 1] = tim[i] - tmp;
	}
	std::sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++)
		sum[i] = sum[i - 1] + a[i];

	for (int i = 0; i <= p; i++) {
		head[i] = tail[i] = 1;
		q[i][head[i]] = 0;
	}

	for (int i = 1; i <= m; i++)
		for (int j = p; j >= 1; j--) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

#ifdef __DEBUG
	for (int i = 1; i <= m; i++) std::cout << a[i] << ' ';
	std::cout << '\n';
	std::cout << '\n';
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= p; j++) std::cout << f[i][j] << ' ';
		std::cout << '\n';
	}
	std::cout << '\n';
#endif

	std::cout << f[m][p] + ans << '\n';
}


#define __DEBUG
// run: $exec < input
#include <iostream>
#include <algorithm>

int const maxn = 100005;
int const maxp = 107;
long long hill[maxn], tim[maxn];
long long sum[maxn];
long long a[maxn];
int q[maxp][maxn];
int head[maxp], tail[maxp];
long long f[maxn][maxp];
int n, m, p;

long long coord_y(int i, int p) { return f[i][p] + (!i ? 0 : sum[i - 1]); }
long long coord_x(int i) { return i; }
long long slope_y(int i, int j, int p) { return coord_y(i, p) - coord_y(j, p); }
long long slope_x(int i, int j) { return coord_x(i) - coord_x(j); }
bool slope_less(int i1, int j1, int i2, int j2, int p)
{   //                                       |
	//                                       v this <= change to < will wa, because of the zero number, there maybe two same point.
	return slope_y(i1, j1, p) * slope_x(i2, j2) < slope_y(i2, j2, p) * slope_x(i1, j1);
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> p;
	for (int i = 1; i < n; i++) {
		std::cin >> sum[i];
		sum[i] += sum[i - 1];
	}
	long long ans = 0;
	for (int i = 0; i < m; i++) {
		std::cin >> hill[i] >> tim[i];
		auto tmp = sum[hill[i] - 1];
		if (tim[i] < tmp) {
			ans += tmp - tim[i];
			a[i + 1] = 0;
		} else
			a[i + 1] = tim[i] - tmp;
	}
	std::sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++)
		sum[i] = sum[i - 1] + a[i];

	for (int i = 0; i <= p; i++) {
		head[i] = tail[i] = 1;
		q[i][head[i]] = 0;
	}

	for (int i = 1; i <= m; i++)
		for (int j = 1; j <= p; j++) {
			auto & h = head[j - 1];
			auto & t = tail[j - 1];
			auto & que = q[j - 1];
			while (h < t && slope_y(que[h + 1], que[h], j - 1) <= a[i] * slope_x(que[h + 1], que[h]))
				h++;
			int k = que[h];
			f[i][j] = f[k][j - 1] + (i - k - 1) * a[i] - (sum[i - 1] - sum[k]);
			auto & h1 = head[j];
			auto & t1 = tail[j];
			auto & que2 = q[j];
			while (h1 < t1 && slope_less(i, que2[t1], que2[t1], que2[t1 - 1], j))
				t1--;
			que2[++t1] = i;
		}

#ifdef __DEBUG
	for (int i = 1; i <= m; i++) std::cout << a[i] << ' ';
	std::cout << '\n';
	std::cout << '\n';
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= p; j++) std::cout << f[i][j] << ' ';
		std::cout << '\n';
	}
	std::cout << '\n';
#endif

	std::cout << f[m][p] + ans << '\n';
}


#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>

using namespace std;
#define min(a,b) (((a)<(b))?(a):(b))
template <class T> void qread(T &x)
{
	x=0;char ch=getchar();bool fh=0;
	while(ch<'0'||ch>'9')
	{
		fh|=(ch=='-');
		ch=getchar();
	}
	while(ch<='9'&&ch>='0')
	{
		x=(x<<1)+(x<<3)+(ch&15);
		ch=getchar();
	}
	x=fh?(-x):x;
	return;
}
void print(__int128 x)
{
    if(x<0)
    {
        x=-x;
        putchar('-');
    }
    if(x>9) print(x/10);
    putchar(x%10+'0');
    return;
}

int n,m,p;
int dis[20086],sumt[20086],t[10086];
__int128 f[110][10086],y[10086];
__int128 q[10086],head,tail;

int main()
{
	int i,j;
    qread(n);qread(m);qread(p);
    for(i=2;i<=n;i++)
    {
    	qread(dis[i]);
    	dis[i]+=dis[i-1];
    }
    for(i=1;i<=m;i++)
    {
    	int aim;
    	qread(aim);qread(t[i]);
    	t[i]-=dis[aim];
    }//read

    sort(t+1,t+m+1);
    for(i=1;i<=m;i++)
    {
    	sumt[i]=sumt[i-1]+t[i];
    }
    memset(f,0x7f,sizeof(f));
    f[0][0]=0;//init

    for(i=1;i<=p;i++)
    {
    	for(j=1;j<=m;j++)
    	{
    		y[j]=f[i-1][j]+sumt[j];
    	}
    	head=tail=1;q[1]=0;
    	for(j=1;j<=m;j++)
    	{
    		while(head<tail&&y[q[head+1]]-y[q[head]]<=(q[head+1]-q[head])*t[j])head++;
    		f[i][j]=min(f[i-1][j],y[q[head]]+t[j]*(j-q[head])-sumt[j]);

    		if(y[j]>=0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f)continue;

    		while(head<tail&&(y[q[tail]]-y[q[tail-1]])*(j-q[tail])>=(y[j]-y[q[tail]])*(q[tail]-q[tail-1]))
			{
				tail--;
			}
			tail++;
			q[tail]=j;
    	}
    }

    print(f[p][m]);putchar('\n');
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define M 110
#define int long long
int n,m,p,dis[N],t[N],h[N],f[M][N],s[N],a[N];
int q[N],ll=1,rr=1;
int ans=LLONG_MAX;
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	//ios::sync_with_stdio(false);
	//cin.tie(0),cout.tie(0);
	cin>>n>>m>>p;
	for(int i=1;i<n;++i){
		scanf("%lld",dis+i);
		dis[i]+=dis[i-1];
	}
	for(int i=1;i<=m;++i){
		scanf("%lld%lld",t+i,h+i);
		a[i]=t[i]-dis[h[i]-1];
	}
	sort(a+1,a+m+1);
	for(int i=1;i<=m;++i)
		s[i]=s[i-1]+a[i];
	for(int i=1;i<=m;++i){
		f[1][i]=i*a[i]-s[i];
	}
	ans=f[1][m];
	for(int i=2;i<=p;++i){
		ll=rr=1;
		int now=i-1;
		q[1]=0;
		for(int j=1;j<=m;++j){
			while(ll<rr&&(s[q[ll+1]]+f[now][q[ll+1]]-a[j]*q[ll+1])<(s[q[ll]]+f[now][q[ll]]-a[j]*q[ll]))ll++;
			int k=q[ll];
			f[i][j]=f[now][k]+s[k]-a[j]*k+a[j]*j-s[j];
			while(ll<rr&&((f[now][j]+s[j])-(f[now][q[rr]]+s[q[rr]]))*(q[rr]-q[rr-1])<(f[now][q[rr]]+s[q[rr]]-f[now][q[rr-1]]+s[q[rr-1]])*(j-q[rr]))rr--;
			q[++rr]=j;
		}
		ans=min(ans,f[i][m]);
	}
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
#define ll long long
int n,m,p;
ll ds[maxn],c[maxn],cnt,ns,num,f[maxn][2];
ll sc[maxn];
#define pii pair<int,int>
vector<ll> g[maxn];
int q[maxn],head,tail,x;
double Y(int i){
	return f[i][x^1]+sc[i];
}
double slope(int i,int j){
	return (Y(i)-Y(j))/(i-j);
}
int main()
{
	#ifndef ONLINE_JUDGE
    freopen("in", "r", stdin);
  //  freopen("add2.out","w",stdout);
    #endif // !ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
	cin>>n>>m>>p;
	for(int i=2;i<=n;i++){
		ll x;	cin>>x;
		ds[i]=ds[i-1]+x;
	}
	for(int i=1;i<=m;i++){
		int h,t;	cin>>h>>t;
		c[++cnt]=t-ds[h];
	}
	sort(c+1,c+cnt+1);
	for(int i=1;i<=cnt;i++)	sc[i]=sc[i-1]+c[i];
	memset(f,100,sizeof(f));	f[0][1]=0;
	for(int j=1;j<=p;j++){
		head=tail=0;
		for(int i=1;i<=cnt;i++){
			while(head<tail&&slope(q[head+1],q[head])<=c[i])	head++;
			int k=q[head];
			f[i][x]=f[k][x^1]-k*c[i]+sc[k]+i*c[i]-sc[i];
			f[i][x]=min(f[i][x],f[i][x^1]);
			if(sc[k]>maxn)	continue;
			while(head<tail&&slope(i,q[tail-1])<slope(q[tail],q[tail-1]))	tail--;
			q[++tail]=i;
		}
		x^=1;
	}
	cout<<f[cnt][x^1]<<'\n';
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 100010
#define MAXp 110
long long m,n,p,d[MAXN],t[MAXN],f[MAXN][MAXp],st[MAXN];
inline int getn(){
	int a=0;
	bool b=1;
	char c=getchar();
	for(;!((c>='0'&&c<='9')||c=='-');) c=getchar();
	for(;(c>='0'&&c<='9')||c=='-';){
		if(c=='-') b=0,c=getchar();
		a=(a<<1)+(a<<3)+int(c)-48;
		//printf("%d\n",a);
		c=getchar();
	}
	if(!b) return -a;
	return a;
}
signed main(){
	n=getn(); m=getn(); p=getn();
	for(int i=2;i<=n;i++){
		int a=getn();
		d[i]=d[i-1]+a;
	}
	for(int i=1;i<=m;i++){
		int a=getn(),b=getn();
		t[i]=b-d[a];
	}
	sort(t+1,t+m+1);
	/*for(int i=1;i<=m;i++) printf("%lld ",t[i]);
		printf("\n");*/
	memset(f,0x3f,sizeof(f));
	for(int i=1;i<=m;i++) st[i]=st[i-1]+t[i];
	for(int i=1;i<=p;i++) f[i][0]=0;
	for(int i=1;i<=m;i++) f[1][i]=i*t[i]-st[i];
	for(int i=2;i<=p;i++)
		for(int j=1;j<=m;j++)
			for(int k=0;k<=j;k++)
				f[i][j]=min(f[i][j],f[i-1][k]-st[j]+st[k]+(j-k)*t[j]);
	printf("%lld\n",f[p][m]);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define ll long long
#define min(x,y) (x<y?x:y)
using namespace std;
int n,m,people,l,r;
ll INF,f[100][100010],fuck[100010],sumfuck[100010],sumt[100010],stk[100010],y[100010];
inline int read()
{
    int y=0,f=1;
    char c=getchar();
    for(;!isdigit(c);c=getchar())
        if(c=='-')
            f=-1;
    for(;isdigit(c);c=getchar())
        y=(y<<3)+(y<<1)+c-'0';
    return y*f;
}
int main()
{
    register int i,j,k;
	n=read();
	m=read();
	people=read();
	for(i=2;i<=n;++i)
	{
		j=read();
		sumt[i]=sumt[i-1]+j;
	}
	for(i=1;i<=m;i++)
	{
		j=read();
		k=read();
		fuck[i]=k-sumt[j];
	}
	sort(fuck+1,fuck+1+m);
	for(i=1;i<=m;i++)sumfuck[i]=sumfuck[i-1]+fuck[i];
	memset(f,0x3f,sizeof(f));
	f[0][0]=0;
	for(i=1;i<=people;++i)
	{
		for(k=1;k<=m;++k) y[k]=f[i-1][k]+sumfuck[k];
		l=r=1;
		stk[1]=0;
		for(j=1;j<=m;j++)
		{
			while( l<r && y[stk[l+1]] - y[stk[l]] <= fuck[j] * (stk[l+1] - stk[l])) l++;
			f[i][j]=min(f[i-1][j] , y[stk[l]] + fuck[j] * (j-stk[l]) - sumfuck[j]);
			if(y[j]>=0x3f3f3f3f3f3f3f3fll)continue;
			while(l<r && (y[j]-y[stk[r]]) * (stk[r]-stk[r-1]) <= (y[stk[r]] - y[stk[r-1]]) * (j-stk[r]) )
				r--;
			stk[++r]=j;
		}
	}
	cout<<f[people][m]<<endl;
}


#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+100;
inline LL min(LL a,LL b){return a<b?a:b;}
template<typename T> inline void gt(T &x)
{
    x=0;T f=1;
    char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    x*=f;
}
template<typename T> inline void pt(T x)
{
    if(x<0)x=-x,putchar('-');
    if(x>9)pt(x/10);
    putchar(x%10+'0');
}
template<typename T>inline void wr(T x){pt(x),putchar('\n');}
template<typename T>inline void wr2(T x){pt(x),putchar(' ');}
inline bool cmp(LL a,LL b){return a<b;}
LL d,sd[N],h,t,a[N],sa[N],f[110][N],q[N],g[N];
int main()
{
	int n,m,p,i,j;
	/*freopen("text.in","r",stdin);*/
	gt(n);gt(m);gt(p);
	for(i=2;i<=n;++i)
	{
		gt(d);sd[i]=sd[i-1]+d;
	}
	for(i=1;i<=m;++i)
	{
		gt(h);gt(t);
		a[i]=t-sd[h];
	}
	sort(a+1,a+m+1,cmp);
	memset(f,0x3f,sizeof(f));
	f[0][0]=0;
	for(i=1;i<=m;++i)sa[i]=sa[i-1]+a[i];
	for(i=1;i<=p;++i)
	{
		h=1,t=1;q[1]=0;
		for(j=1;j<=m;++j)g[j]=f[i-1][j]+sa[j];
	    for(j=1;j<=m;++j)
	    {
	    	while(h<t&&f[i-1][q[h+1]]+sa[q[h+1]]-f[i-1][q[h]]-sa[q[h]]<=a[j]*(q[h+1]-q[h]))++h;
	    	f[i][j]=min(f[i-1][j],g[q[h]]+(j-q[h])*a[j]-sa[j]);
			if(g[j]>=0x3f3f3f3f3f3f3f3fll)continue;
	    	while(h<t&&(g[q[t]]-g[q[t-1]])*(j-q[t])>=(g[j]-g[q[t]])*(q[t]-q[t-1]))--t;
	    	q[++t]=j;
		}
	}
	wr(f[p][m]);
	return 0;
}