type nodd=record
x,d:longint;
end;
var c:array[0..5010]of longint;
a:array[0..5010]of nodd;
n,m,t,k,i,nn,sum:longint;
procedure down(t:longint);
var x,d,tt:longint;
begin
x:=a[t].x; d:=a[t].d;
while t+t<=nn do
begin
tt:=t+t; if (tt<nn)and(a[tt].d<a[tt+1].d) then inc(tt);
if a[tt].d<=d then break;
a[t]:=a[tt]; t:=tt;
end;
a[t].x:=x; a[t].d:=d;
end;
procedure up(t:longint);
var x,d:longint;
begin
x:=a[t].x; d:=a[t].d;
while t>1 do
begin
if a[t shr 1].d>=d then break;
a[t]:=a[t shr 1]; t:=t shr 1;
end;
a[t].x:=x; a[t].d:=d;
end;
procedure init;
begin
readln(n,m,t,k);
m:=m-(n-1)*t-1; nn:=0;
for i:=1 to n do
begin
read(t,c[i]);
if t>0 then
begin
inc(nn); a[nn].x:=i; a[nn].d:=t;
up(nn);
end;
end;
end;
procedure work;
begin
sum:=0;
while m>=k do
begin
m:=m-k; sum:=sum+a[1].d;
if a[1].d>c[a[1].x] then dec(a[1].d,c[a[1].x]) else
begin
a[1]:=a[nn]; dec(nn); if nn<1 then break;
end;
down(1);
end;
writeln(sum);
end;
begin
assign(input,'fisha.in');reset(input);
assign(output,'fisha.out');rewrite(output);
init;
work;
close(output);
end.