#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define all(n) (n).begin(), (n).end()
#define se second
#define fi first
#define pb emplace_back
#define mp make_pair
#define sqr(n) ((n)*(n))
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define precision(a) setiosflags(ios::fixed) << setprecision(a)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef double db;

template <typename T> inline char read(T &x) {
    x = 0; T fg = 1; char ch = getchar();
    while (!isdigit(ch)) {if (ch == '-') fg = -1;ch = getchar();}
    while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ '0'), ch = getchar();
    x = fg * x; return ch;
}
template <typename T, typename... Args> inline void read(T &x, Args &... args) { read(x), read(args...); }
template <typename T> inline void write(T x) {
    int len = 0; char c[21]; if (x < 0) putchar('-'), x = -x;
    do{++len; c[len] = x % 10 + '0';} while (x /= 10);
    for (int i = len; i >= 1; i--) putchar(c[i]);
}
template <typename T, typename... Args> inline void write(T& x, Args &... args) { write(x), write(args...); }

template<class T1, class T2> bool umin(T1& a, T2 b) { return a > b ? (a = b, true) : false; }
template<class T1, class T2> bool umax(T1& a, T2 b) { return a < b ? (a = b, true) : false; }
template<class T> void clear(T& a) { T().swap(a); }

const int N = 1e6 + 5;

int n, m, _, q, cas;
int x[N], y[N];
PII e[N];
bool v[55];

int main() {
	IOS; cin >> n >> m >> q;
	rep (i, 1, n) cin >> e[i].fi >> e[i].se;
	sort(e + 1, e + 1 + n, [](PII& a, PII& b) { return a.se > b.se; });
	rep (i, 1, m) cin >> x[i];	 
	while (q--) {
		int l, r, cnt = 0, ans = 0; cin >> l >> r;
		rep (i, 1, l - 1) y[++cnt] = x[i];
		rep (i, r + 1, m) y[++cnt] = x[i];
		sort(y + 1, y + 1 + cnt); memset(v, 0, sizeof v);
		rep (i ,1, n) rep (j, 1, cnt) if (y[j] >= e[i].fi && !v[j]) {
			v[j] = 1; ans += e[i].se; break;
		}
		cout << ans << '\n';
	}
	return 0;
}
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
const ll maxn=5e5+20;

const ll mod=1e9+7;
const ll m2=1e9+7;
const ll INF64 = ll(1e18);
const ll max2=10500000;
int r,c,a,b;
map<vector<int>,int> m1;
int dp[(1<<16)][20][20],dp2[(1<<16)][20][20];
void num(int one,int two,int prev,int mask,int pos)
{	if(pos==r)
	{
		vector<int> v;
		v={one,two,mask};
		m1[v]++;
		//cout<<one<<" "<<two<<" "<<mask<<"\n";
		return;

	}
	int arr[2];
	arr[0]=((prev&(1<<pos))!=0);
	if(pos+1<r)
	{
		arr[1]=((prev&(1<<(pos+1)))!=0);
		if(arr[0]==0 && arr[1]==0)
		{
			num(one+1,two,prev,mask+(1<<pos),pos+1);
			//num(one+2,two,prev,mask+(1<<pos)+(1<<(pos+1)),pos+1);
			num(one,two+1,prev,mask,pos+2);

		}
		else if(arr[0]==1 && arr[1]==1)
		{	
			num(one-1,two+1,prev,mask,pos+1);
			//num(one-2,two+2,prev,mask,pos+2);
			num(one,two+1,prev,mask,pos+2);
			num(one+1,two,prev,mask+(1<<pos),pos+1);
			//num(one+2,two,prev,mask+(1<<pos)+(1<<(pos+1)),pos+2);
		}
		else if(arr[0]==1 && arr[1]==0)
		{
			num(one-1,two+1,prev,mask,pos+1);
			num(one,two+1,prev,mask,pos+2);
			num(one+1,two,prev,mask+(1<<pos),pos+1);
		}
		else
		{
			num(one+1,two,prev,mask+(1<<pos),pos+1);
			num(one,two+1,prev,mask,pos+2);
		}

	}
	else
	{
		if(arr[0]==0)
		{
			num(one+1,two,prev,mask+(1<<pos),pos+1);
		}
		else
		{	
			num(one+1,two,prev,mask+(1<<pos),pos+1);
			num(one-1,two+1,prev,mask,pos+1);
		}
	}

}
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 i,j,k,l,l1;
cin>>r>>c>>b>>a;
dp[0][0][0]=1;

for(i=0;i<c;++i)
{for(l1=0;l1<(1<<r);++l1)
	{
		for(j=0;j<=(r*c);++j)
			for(k=0;k<=(r*c);++k)
				dp2[l1][j][k]=0;
	}
	for(j=0;j<(1<<r);++j)
	{	m1.clear();
		if(c==1)
			if(j!=0)
				continue;
		num(0,0,j,0,0);


		for(k=0;k<=(r*c);++k)
		{
			for(l=0;l<=(r*c);++l)
			{
				for(auto x:m1)
				{
					vector<int> v2=x.first;
					
					if(k+v2[0]>=0 && l+v2[1]>=0)
					{
						dp2[v2[2]][k+v2[0]][l+v2[1]]+=dp[j][k][l]*x.second;
						/*if(i==1 && v2[0]==2 && v2[1]==0 && j==3 && k==2 && l==0)
						cout<<k<<" "<<l<<"\n";*/
					}
				}
			}
		}


	}
	for(j=0;j<(1<<r);++j)
	{
		for(k=0;k<=r*c;++k)
		{
			for(l=0;l<=(r*c);++l)
				{dp[j][k][l]=dp2[j][k][l];
					
				}
		}
	}
}
int ans=0;

for(j=0;j<(1<<r);++j)
{
	ans+=dp[j][a][b];
}
cout<<ans;

return(0);
}

