#pragma GCC optimize ("O3") #pragma GCC target ("avx2") // or sse4 #pragma GCC optimize("unroll-loops") #include using namespace std; using Int = long long; const char newl = '\n'; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a void drop(const T &x){cout< vector read(size_t n){ vector ts(n); for(size_t i=0;i>ts[i]; return ts; } //INSERT ABOVE HERE using ull = unsigned long long; const int MAX = 1e5+10; ull as[MAX]; ull bs[MAX]; const ull INF = 1e19; ull dp[MAX]; ull vs[MAX]={}; signed main(){ cin.tie(0); ios::sync_with_stdio(0); int n,c; cin>>n>>c; for(int i=0;i>as[i]>>bs[i]; fill(dp,dp+MAX,INF); for(int i=1;i<=n;i++) vs[i]=vs[i-1]+i*c; dp[0]=0; for(int i=0;i