program RenWuAnPai;
const
maxn=5000;
var
f:array[0..maxn] of int64;
t,w:array[1..maxn] of integer;
tt,ww:array[0..maxn] of longint;
i,j,n,s:integer;
w1,t1:longint;
min:int64;
begin
assign(input,'batch.in');
reset(input);
assign(output,'batch.out');
rewrite(output);
readln(n);
readln(s);
for i:=1 to n do
begin
readln(t[i],w[i]);
tt[i]:=tt[i-1]+t[i];
ww[i]:=ww[i-1]+w[i]
end;
for i:=1 to n do
begin
w1:=ww[i];
t1:=tt[i];
min:=f[0]+(s+t1)*w1+(s+t1)*(ww[n]-ww[i]);
for j:=1 to i-1 do
begin
w1:=w1-w[j];
t1:=t1-t[j];
if min>f[j]+(s+t1)*w1+(s+t1)*(ww[n]-ww[i])
then min:=f[j]+(s+t1)*w1+(s+t1)*(ww[n]-ww[i])
end;
f[i]:=min
end;
writeln(f[n]);
close(input);
close(output)
end.