var
n,s,a,sum,i,j,k,h:longint;
c,y,b,m:array[1..100000]of longint;
fin,fout:text;
begin
assign(fin,'factory.in');reset(fin);
assign(fout,'factory.out');rewrite(fout);
read(fin,n,s);
for i:=1 to n do
read(fin,c[i],y[i]);
for i:=2 to n do begin
a:=s;j:=0;
repeat
inc(j);
if c[i]-a>c[i-j] then c[i]:=c[i-j]+a;
a:=a+s;
until i-j=1;
end; a:=10;j:=0;
sum:=c[1]*y[1];
repeat
inc(j);
b[j]:=sum mod a;
sum:=sum div a;
until sum=0;
for i:=2 to n do
begin
sum:=c[i]*y[i];k:=0;
repeat
inc(k);
m[k]:=sum mod a;
sum:=sum div a;
until sum=0;
if k>j then j:=k;
for h:=1 to j do
begin
if b[h]+m[h]>=10 then b[h+1]:=b[h+1]+1;
b[h]:=(b[h]+m[h]) mod 10;
end;
if b[j+1]=1 then inc(j);
end;
for i:=j downto 1 do
write(fout,b[i]);
close(fin);
close(fout);
end.