#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,sn;
    cin >> n >> sn;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n);
    map<ll,ll> day;
    for(int i = 0;i < n;i++){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--,b[i]--;
        day[a[i]]++,day[b[i]]++;
      day[b[i]+1]++;
    }
    ll si = day.size();
    map<ll,ll> dtoi;
    ll nowc = 0;
    for(auto i:day){
        dtoi[i.first] = nowc;
        nowc++;
    }
    vector<ll> itod;
    for(auto i:day){
        itod.push_back(i.first);
    }
    itod.push_back(itod[itod.size() - 1] + 1);

    
    vector<ll> sum(si+1,0);
    for(int i = 0;i < n;i++){
        ll ait = dtoi[a[i]];
        ll bit = dtoi[b[i]];
        sum[ait] += c[i],sum[bit + 1] -= c[i];
    }
//cout << sum[0] << " " << sum[1] << " " << sum[2] << " " << sum[3] << " " << sum[4] << endl;

    for(int i = 1;i < si;i++)sum[i] += sum[i - 1];
    //cout << sum[0] << " " << sum[1] << " " << sum[2] << " " << sum[3] << " " << sum[4] << endl;


    ll res = 0;
    for(int i = 0;i < si;i++){
        res += min(sn,sum[i]) * (itod[i + 1] - itod[i]);
    }
  //cout << itod[0] << " "<< itod[1] << " " << itod[2] << " " << itod[3] << " " << itod[4] << endl;
    cout << res << endl;
}
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#define ll long long
#define MAXN 200005
#define uns unsigned
#define INF 0x3f3f3f3f
using namespace std;
inline ll read(){
	ll x=0;bool f=1;char s=getchar();
	while((s<'0'||s>'9')&&s>0){if(s=='-')f^=1;s=getchar();}
	while(s>='0'&&s<='9')x=(x<<1)+(x<<3)+s-'0',s=getchar();
	return f?x:-x;
}
int n,m,q,sr[55];
ll w[55],v[55],x[55];
bool vis[55];
inline bool cmp(int a,int b){
	return v[a]>v[b];
}
int main()
{
	n=read(),m=read(),q=read();
	for(int i=1;i<=n;i++)w[i]=read(),v[i]=read(),sr[i]=i;
	for(int i=1;i<=m;i++)x[i]=read();
	sort(sr+1,sr+1+n,cmp);
	while(q--){
		int l=read(),r=read();
		ll ans=0;
		for(int i=1;i<=m;i++)vis[i]=0;
		for(int i=1;i<=n;i++){
			int u=sr[i],y=0;
			for(int j=1;j<=m;j++){
				if(j>=l&&j<=r)continue;
				if(!vis[j]&&x[j]>=w[u]){
					if(!y)y=j;
					else if(x[j]<x[y])y=j;
				}
			}
			if(y)vis[y]=1,ans+=v[u];
		}
		printf("%lld\n",ans);
	}
	return 0;
}