program xmz;
var
t:array[1..5000]of longint;
f:array[1..5000]of longint;
s:array[0..5000]of longint;
ts:array[0..5000]of longint;
x:array[0..5000]of longint;
a,b,c,n,ss:longint;
f1,f2:text;
begin
assign(f1,'batch.in');assign(f2,'batch.out');
reset(f1);rewrite(f2);
read(f1,n,ss);
for a:=1 to n do
read(f1,t[a],f[a]);
s[n]:=f[n];ts[n]:=t[n];
for a:=n downto 2 do
begin
s[a-1]:=s[a]+f[a-1];
ts[a-1]:=ts[a]+t[a-1];
end;
for a:=1 to n do
begin
x[a]:=(ts[1]-ts[a+1]+ss)*s[1];
for b:=2 to a do
if x[a]>x[b-1]+(ts[b]-ts[a+1]+ss)*s[b] then
x[a]:=x[b-1]+(ts[b]-ts[a+1]+ss)*s[b];
end;
write(f2,x[n]);
close(f1);close(f2);
end.