// O(n^2)#include<iostream>usingnamespace std;typedeflonglong LL;constint N =10010;structnode{int c, y;};int n, s;
node a[N];intmain(){
cin >> n >> s;for(int i =1; i <= n;++ i) cin >> a[i].c >> a[i].y;
LL res =0;for(int i =1; i <= n;++ i){int val = a[i].c;// 最低的单位成本for(int j =1; j <= i -1;++ j)
val =min(val, a[j].c +(i - j)* s);
res += val * a[i].y;}
cout << res << endl;return0;}// O(n)#include<iostream>#defineinf0x3f3f3f3fusingnamespace std;typedeflonglong LL;constint N =10010;structnode{int c, y;};int n, s;
node a[N];intmain(){
cin >> n >> s;for(int i =1; i <= n;++ i) cin >> a[i].c >> a[i].y;
LL res =0;int val = inf;for(int i =1; i <= n;++ i){
val =min(a[i].c, val + s);// 优化
res += val * a[i].y;}
cout << res << endl;return0;}