#include <bits/stdc++.h>
#include <cassert>
#define rep(i, N) for (int i = 0; i < (N); ++i)
#define rep2(i, a, b) for (ll i = a; i <= b; ++i)
#define rep3(i, a, b) for (ll i = a; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define nl '\n'
#define endl '\n'
#define all(c) begin(c), end(c)
#define ok() puts(ok ? "Yes" : "No");
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using vs = vector<string>;
using P = pair<ll, ll>;
using gt = greater<P>;
using minq = priority_queue<P, vector<P>, gt>;
using vP = vector<P>;
template <class T> void takeUnique(vector<T> &v) {
  auto last = std::unique(v.begin(), v.end());
  v.erase(last, v.end());
}
template <class T> void print(const initializer_list<T> &il) {
  for (auto x : il) {
    cout << x << " ";
  }
  cout << "\n";
}
inline void priv(vi a) {
  rep(i, (int)a.size())
      printf("%d%c", a[i], i == (int)a.size() - 1 ? '\n' : ' ');
}
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int dxx[] = {0, 1, 1, 1, 0, -1, -1, -1};
int dyy[] = {1, 1, 0, -1, -1, -1, 0, 1};
// clang++ -std=c++11 -stdlib=libc++

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N, M, Q;
  cin >> N >> M >> Q;
  vi W(N);
  vi V(N);
  vii I(N);
  vi X(M);
  rep(i, N) cin >> I[i].fi >> I[i].se;
  rep(i, M) cin >> X[i];
  sort(all(I));
  while (Q--) {
    int L, R;
    cin >> L >> R;
    // dp[i][j][k]:=max value s.t., seen i items, j th box has k space
    L--, R--;
    vi B;
    rep(i, M) {
      if (i <= R and i >= L)
        continue;
      B.pb(X[i]);
    }
    sort(all(B));
    int p = 0;
    priority_queue<int> valq;
    ll ans = 0;
    rep(i, B.size()) {
      while (p < N and I[p].fi <= B[i]) {
        valq.push(I[p].se);
        p++;
      }
      if (valq.empty())
        continue;
      int v = valq.top();
      valq.pop();
      ans += v;
    }
    cout << ans << endl;
  }
  return 0;
}

// テスト
#include<ctime>
#include<cmath> 
#include<queue>
#include<cstdio>
#include<cctype>
#include<algorithm>
#define ll long long
using namespace std;
const ll N=2e5+7;
const ll INF=1ll<<55;
ll read() {
	char c;
	ll x=0,f=1;
	while(!isdigit(c=getchar()))
		f-=2*(c=='-');
	while (isdigit(c)){
		x=x*10+(c-48)*f;
		c=getchar();
	}
	return x;
}
struct edge{
	ll to,c,d,nxt;
	edge(ll to=0,ll c=0,ll d=0,ll nxt=0):to(to),c(c),d(d),nxt(nxt){}
}e[N];
ll n,m,a,b,c,d,tot,head[N],dis[N],vis[N];
void add(ll u,ll v,ll c,ll d){
	e[++tot]=edge(v,c,d,head[u]);
	head[u]=tot;
}
struct node{
	ll i,d;
	node(ll i=0,ll d=0):i(i),d(d){}
	friend bool operator <(node a,node b){
		return a.d>b.d;
	}
};
ll dijkstra(){
	priority_queue<node>q;
	for(ll i=1;i<=n;++i)
		dis[i]=INF;
	dis[1]=0;
	q.push(node(1,0));
	while(!q.empty()){
		node u=q.top();
		q.pop();
		ll x=u.i;
		if(vis[x])
			continue;
		vis[x]=1;
		for(ll i=head[x];i;i=e[i].nxt){
			ll y=e[i].to;
			ll c=e[i].c;
			ll d=e[i].d;
			ll t=sqrt(d);
			if(dis[x]<=t-1){
				for(ll j=-3;j<=3;++j){
					if(t+j<=0)
						continue;
					dis[y]=min(dis[y],(t+j)+d/(t+j)+c-1);
				}
				q.push(node(y,dis[y]));
			}
			if(dis[y]>dis[x]+c+d/(dis[x]+1)){
				dis[y]=dis[x]+c+d/(dis[x]+1);
				q.push(node(y,dis[y]));
			}
		}
	}
	if(dis[n]==INF)
		return -1;
	return dis[n];
}
int main() {
	#ifndef ONLINE_JUDGE
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
	#endif
	clock_t t1=clock();
	//--------
	n=read();
	m=read();
	for(int i=1;i<=m;++i){
		a=read();
		b=read();
		c=read();
		d=read();
		add(a,b,c,d);
		add(b,a,c,d);
	}
	printf("%lld",dijkstra());
	//--------
	clock_t t2=clock();
	fprintf(stderr,"time:%0.3lfs",1.0*(t2-t1)/CLOCKS_PER_SEC);
	return 0;
}