#include<bits/stdc++.h>
using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU

void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	off;
}
LL n,m,q;
vector<pair<LL,LL>> arr;
int main(){
	IO();
	cin>>n>>m>>q;
	arr.resize(n);
	LL w,v;
	rep(i,0,n){
		cin>>w>>v;
		arr[i].F = v;
		arr[i].S = w;
	}
	VL brr(m);
	rep(i,0,m){
		cin>>brr[i];
	}
	sort(ALL(arr), greater<pair<LL, LL>>());
	LL l, r;
	rep(i,0,q){
		cin>>l>>r;
		l--;r--;
		VL temp;
		for(LL j=0;j<l;j++){
			temp.PB(brr[j]);
		}
		for(LL j=r+1;j<m;j++){
			temp.PB(brr[j]);
		}
		if(SZ(temp) == 0){
			dout(0);
		}
		else{
			LL ans = 0;
			LL ss = SZ(temp);
			sort(ALL(temp));
			VL visited(ss, 0);
			rep(j,0,n){
				rep(k,0,ss){
					if(!visited[k]){
						if(temp[k] >= arr[j].S){
							visited[k] = 1;
							ans += arr[j].F;
							break;
						}
					}
				}
			}
			dout(ans);
		}
	}
	return 0;
}
#include<bits/stdc++.h>
#define M 1005
typedef long long ll;
using namespace std;
int stp[M][M][27];
int n,m;
int to[2*M],nxt[2*M],hd[M][26],cnte;
void adde(int u,int v,int c){
	to[++cnte]=v;
	nxt[cnte]=hd[u][c];
	hd[u][c]=cnte;
}
struct node{int x,y,c;};
queue<node> Q;
int BFS(){
	int x,y,c;
	while(!Q.empty()){
		x=Q.front().x;
		y=Q.front().y;
		c=Q.front().c;
		if((c==26)&&((x==1&&y==n)||(x==n&&y==1)))return stp[x][y][26];
		Q.pop();
		if(c==26){
			for(int i=0;i<26;++i)
				for(int j=hd[x][i],z;j;j=nxt[j]){
					if(~stp[z=to[j]][y][i])continue;
					stp[z][y][i]=stp[x][y][c]+1;
					Q.push((node){z,y,i});
				}
		}else{
			for(int j=hd[y][c],z;j;j=nxt[j]){
				if(~stp[x][z=to[j]][26])continue;
				stp[x][z][26]=stp[x][y][c]+1;
				Q.push((node){x,z,26});
			}
		}
	}
	return -1;
}
int main(){
	cin>>n>>m; 
	memset(stp,-1,sizeof(stp));
	for(int i=1;i<=n;++i){
		stp[i][i][26]=0;
		Q.push((node){i,i,26});
	}
	int u,v;char c[5];
	for(int i=1;i<=m;++i){
		scanf("%d%d%s",&u,&v,c);
		if(u>v)swap(u,v);
		adde(u,v,c[0]-'a');
		adde(v,u,c[0]-'a');
		if(u==v)continue;
		stp[u][v][26]=1;
		stp[v][u][26]=1;
		Q.push((node){u,v,26});
		Q.push((node){v,u,26});
	}
	cout<<BFS();
	return 0;
}