#include using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N,Q; cin >> N >> Q; vector x(N),w(N); for (int i=0;i> x[i] >> w[i]; vector X(Q); for (int i=0;i> X[i]; vector> pos; for (int i=0;i ans(Q); for (auto p:pos){ int y=p.first,id=p.second; now+=cnt*(y-last); now-=(sum-cnt)*(y-last); if (id>0) cnt+=id; else ans[-id]=now; last=y; } for (int i=0;i