#include <iostream>
#include <fstream>
using namespace std;
int i,j,k,l;
int n,m,s;
int t[5010],f[5010],w[5010];
int tmp;
int main()
{
ifstream fin("batch.in");
ofstream fout("batch.out");
fin>>n>>s;
for (i=1;i<=n;i++)
fin>>t[i]>>f[i];
f[n+1]=t[n+1]=0;
for (i=n;i>=1;i--)
{
f[i]=f[i]+f[i+1];
t[i]=t[i]+t[i+1];
}
w[n]=f[n]*t[n];
w[n+1]=0;
for (i=n-1;i>=1;i--)
{
w[i]=f[i]*t[i];
for (j=n+1;j>i;j--)
if ( (tmp= (w[j]+(s+t[i]-t[j])*f[j]+(f[i]-f[j])*(t[i]-t[j])) )<w[i] )
w[i]=tmp;
}
fout<<w[1]+s*f[1]<<endl;
fin.close();
fout.close();
return 0;
}