#include<bits/stdc++.h>
using namespace std;
typedef  long long   ll;
ll inf=1e18,mod=1e9+7;

ll fun(ll n){
    ll res=0;
    while(n){
        res++;
        n/=10;
    }
    return res;
}

bool comp( pair<ll,ll> a, pair<ll,ll> b){
    if(a.second!=b.second)
    return a.second>b.second;
    return a.first>b.first;
}

int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif

        ll n,m,q;cin>>n>>m>>q;
        ll a,b;
        vector<pair<ll,ll>> arr;
        for(ll i=0;i<n;i++)
        cin>>a>>b,arr.push_back({a,b});

        sort(arr.begin(),arr.end(),comp);
        ll barr[m];
        for(auto &it:barr)cin>>it;

        ll l,r,mi,idx;vector<ll> curr;
        while(q--){
            cin>>l>>r;
            l--;r--;
            curr.clear();
            for(ll i=0;i<=l-1;i++)curr.push_back(barr[i]);
            // cout<<l<<" ";
            for(ll i=r+1;i<m;i++)curr.push_back(barr[i]);
            if(curr.empty()){
                cout<<0<<endl;continue;
            }
            sort(curr.begin(),curr.end());
            ll sum=0,vis[curr.size()]={0};
            for(ll i=0;i<n;i++){
                for(ll j=0;j<curr.size();j++){
                    if(vis[j])continue;
                    if(curr[j]>=arr[i].first){
                        sum+=arr[i].second;
                        vis[j]=1;
                        break;
                    }
                }
            }

            cout<<sum<<endl;

        }




        return 0;

}

#include <bits/stdc++.h>

template <typename T> inline void rd(T& x) {
	int si = 1; char c = getchar(); x = 0;
	while(!isdigit(c)) si = c == '-' ? -1 : si, c = getchar();
	while(isdigit(c)) x = x * 10 + c - 48, c = getchar();
	x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args) { rd(x); rd(args...); }
#define fi first
#define se second
#define mkp std::make_pair
typedef long long ll;
typedef double ff;
typedef std::pair <int, int> pii;
const int N = 5e5 + 5, Inf = 0x3f3f3f3f, Mod = 998244353;
const ll InfLL = 0x3f3f3f3f3f3f3f3fLL;

int n, k, o_dg[N];
std::vector <int> E[N];

void Add(int u, int v) {
	E[u].push_back(v);
	E[v].push_back(u);
	++o_dg[u]; ++o_dg[v];
}

int dg[N], mn[N], col[N];
std::queue <int> que;
bool Check(int mid) {
	memcpy(dg, o_dg, sizeof(dg));
	memset(col, 0x3f, sizeof(col));
	int cnt = 0, lst;
	for(int i = 1; i <= n; ++i) mn[i] = mid;
	for(int i = 1; i <= n; ++i)
		if(dg[i] == 1) que.push(i);
	while(!que.empty()) {
		int u = que.front(); que.pop();
		lst = u;
		if(!mn[u]) ++cnt, col[u] = 0;
		for(auto v : E[u]) {
			--dg[v];
			if(col[u] > mn[u]) mn[v] = std::min(mn[v], mn[u] - 1);
			col[v] = std::min(col[v], col[u] + 1);
			if(dg[v] == 1) que.push(v);
		}
	}
	if(col[lst] > mn[lst]) ++cnt;
	return cnt <= k;
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
#endif
	int test_case_cnt = 1; //rd(test_case_cnt);
	while(test_case_cnt--) {
		rd(n, k);
		for(int i = 1; i < n; ++i) {
			int u, v; rd(u, v);
			Add(u, v);
		}
		int l = 0, r = n - 1;
		while(l < r) {
			int mid = (l + r) >> 1;
			if(Check(mid)) r = mid;
			else l = mid + 1;
		}
		printf("%d\n", l);
	} return 0;
}