#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18;
const int MAXN = 305;
int n,k;
pair<int,int> v[305];
int dp[2][MAXN][MAXN];
int auxdp[MAXN][MAXN], auxdp2[MAXN][MAXN];
map<int, vector<int>> ofh;
void chmin(int&x, int y)
{
x = min(x, y);
}
signed main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>n>>k;
int maxh = 0;
for(int i=1;i<=n;i++)
{
cin>>v[i].first>>v[i].second;
maxh = max(maxh, v[i].first);
ofh[v[i].first].push_back(i);
}
//assert(maxh <= 300);
maxh += n;//-----------------------------------------------------------------------------------------------------------
for(int cnt=0;cnt<=n;cnt++)
for(int free=0;free<=n+1;free++)
dp[1][cnt][free] = INF;
int minc = INF;
dp[1][0][1] = 0;
for(int h=0;h<=maxh;h++)
{
int pas = h%2;
int cur = ofh[h].size(), mincur = INF;
for(int id:ofh[h])
mincur = min(mincur, v[id].second);
int newmin = min(minc, mincur);
for(int cnt=0;cnt<=n;cnt++)
for(int free=0;free<=n+1;free++)
{
dp[pas][cnt][free] = INF;
auxdp2[cnt][free] = dp[1-pas][cnt][free];
if(cnt >= 1) chmin(auxdp2[cnt][free], auxdp2[cnt-1][free]);
auxdp[cnt][free] = INF;
if(minc < INF)
{
if(dp[1-pas][cnt][free] != INF) auxdp[cnt][free] = dp[1-pas][cnt][free] - free * minc;
if(free >= 1) auxdp[cnt][free] = min(auxdp[cnt][free], auxdp[cnt][free-1]);
}
}
if(minc < INF)
{
for(int x=0;x<=n;x++)
{
for(int cnt=0;cnt<=n;cnt++)
{
//x = cnt + dif
int dif = x - cnt;
assert(-cnt <= dif);
if(cur - dif - 1 >= 0)
chmin(dp[pas][x][cur - dif], auxdp[cnt][cur - dif - 1] + (cur - dif) * minc + x * k);
}
}
}
for(int cnt=0;cnt<=n;cnt++)
{
for(int free=0;free<=n+1;free++)
{
int lim = min(n, cnt + free - cur);
if(lim >= 0) chmin(dp[pas][cnt][free], auxdp2[lim][free] + cnt * k);
}
}
minc = newmin;
}
int rez = INF;
for(int free=0;free<=n+1;free++)
rez = min(rez, dp[maxh%2][0][free]);
assert(rez != INF);
cout<<rez;
return 0;
}