#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define bug(a) cout<<#a<<" : "<<a<<endl;
#define bug2(a,b) cout<<#a<<" : "<<a<<"\t"<<#b<<" : "<<b<<endl;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t=1;
// cin>>t;
int cs=1;
while(t--){
// cout<<"Case "<<cs++<<": \n";
ll n,k;cin>>n>>k;
vector<ll>v(n);
int x;
for(int i=0;i<n;i++){
cin>>v[i]>>x;
}
ll ans=0;
sort(v.begin(),v.end());
for(ll i=0; i<n-1; i++)
{
ll x=abs(v[0]-v[i]);
ll y=abs(v[n-1]-v[i]);
ans += k*max(x,y);
}
cout<<ans<<endl;
}
return 0;
}