题意:
思路:
贪
贪
贪
如果当前的c>之前的c+s 那么之前的合适 一直贪下去就好了
//By SiriusRen
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define int long long
int n,s,rec=1,c[10500],y[10500],ans;
signed main(){scanf("%lld%lld",&n,&s);for(int i=1;i<=n;i++)scanf("%lld%lld",&c[i],&y[i]);for(int i=1;i<=n;i++){if(c[i-1]+s<c[i])ans+=y[i]*(c[rec]+s*(i-rec));else rec=i,ans+=y[i]*c[i];}printf("%lld\n",ans);
}