var
w,v,g:array[0..2000005]of longint;
p,q:array[0..2000005]of longint;
s:array[0..2000005]of int64;
ss,ans,min:int64;
m,n,i,j:longint;
l,r,fk:longint;
begin
assign(input,'qc.in');reset(input);
assign(output,'qc.out');rewrite(output);
readln(n,m,ss);
for i:=1 to n do readln(w[i],v[i]);
for i:=1 to m do readln(p[i],q[i]);
l:=0; r:=1000000000;
min:=-1;
while l<r do
begin
fk:=(l+r)div 2;
g[0]:=0;
s[0]:=0;
ans:=0;
for j:=1 to n do
if w[j]>=fk then begin g[j]:=g[j-1]+1; s[j]:=s[j-1]+v[j]; end
else begin g[j]:=g[j-1]; s[j]:=s[j-1]; end;
for j:=1 to m do ans:=ans+(g[q[j]]-g[p[j]-1])*(s[q[j]]-s[p[j]-1]);
if(min=-1)or(abs(ans-ss)<min) then min:=abs(ans-ss);
if ans>ss then l:=fk+1 else r:=fk;
end;
writeln(min);
close(input);close(output);
end.