#include<bits/stdc++.h>
using namespace std;
const int p = 31;
const int m = 1e9 + 7;
typedef long long ll;
typedef int in;
#define ff first
#define ss second
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
bitset<200009>vis;
vector<ll>dp(200009, -1e12);
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<ll>cst(n);
    for (int i = 0; i < n; ++i) {
        cin >> cst[i];
    }

    vector<vector<int>>gr(n);
    for (int i = 0; i < m; ++i) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        gr[x].push_back(y);
    }
    ll ans = -1e12;
    function<ll(int)>f = [&](int i) {
        if (dp[i] > -1e10)return dp[i];
        ll tmp = -1e12;
        vis[i] = 1;
        if (gr[i].empty()) {
            return 0ll;
        }
        for (auto& it : gr[i]) {
            tmp = max(tmp, cst[it] - cst[i] + f(it));
            tmp=max(tmp, cst[it]-cst[i]);
        }
        ans = max(ans, tmp);
        return dp[i] = tmp;
    };
    for (int i = 0; i < n; ++i) {
        if (!vis[i] && !gr[i].empty()) {
            f(i);
        }
    }
    cout << ans;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
const ll maxn=3e5+10;

const ll mod=1e9+7;
const ll m2=1e9+7;
const ll INF64 = ll(1e18);
const ll max2=10500000;


int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
//long long tt = clock();
#endif
ios_base::sync_with_stdio(NULL);  cin.tie(0); cout.tie(0);
int n,m1,q,i,j,k;
cin>>n>>m1>>q;
vector<pair<int,int>> v(n);
for(i=0;i<n;++i)
{int x,y;
	cin>>x>>y;
	v[i]=make_pair(x,y);
}
sort(v.begin(),v.end());
vector<int> w1(m1);
for(i=0;i<m1;++i)
cin>>w1[i];
while(q--)
{
	int l,r,m;
	cin>>l>>r;
	--l,--r;
	vector<int> w;
	for(i=0;i<l;++i)
		w.push_back(w1[i]);

for(i=r+1;i<m1;++i)
	w.push_back(w1[i]);

m=w.size();
sort(w.begin(),w.end());
int dp[m+1][n+1];
for(i=0;i<=m;++i)
	for(j=0;j<=n;++j)
		dp[i][j]=INT_MIN;
for(i=0;i<=n;++i)
{
	dp[0][i]=0;
}
for(i=0;i<=m;++i)
{
	dp[i][0]=0;
}

for(i=1;i<=m;++i)
{
	for(j=1;j<=n;++j)
	{
		// ith box till jth;
		for(k=j;k>=1;--k)
		{
			if(v[k-1].first<=w[i-1])
			{	if(dp[i-1][k-1]!=INT_MIN)
				dp[i][j]=max(dp[i][j],dp[i-1][k-1]+v[k-1].second);
			}
		}
		dp[i][j]=max(dp[i][j],dp[i-1][j]);
	}
}
cout<<dp[m][n]<<"\n";
}


return(0);
}
