#include"bits/stdc++.h" #define int long long #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=(a);i<(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define All(x) (x).begin(),(x).end() #define rAll(x) (x).rbegin(),(x).rend() using namespace std; typedef pair P; typedef vector vi; typedef vector vvi; const int mod=1000000007; int gcd(int x,int y){return y?gcd(y,x%y):x;} int lcm(int x,int y){return x*y/gcd(x,y);} int roundup(int a,int b){return (a-1)/b+1;} signed main(){ int N,Q; cin>>N>>Q; vector x(N),w(N),X(Q); rep(i,N) cin>>x[i]>>w[i]; rep(i,Q) cin>>X[i]; vector S(N+1); int res=0; rep(i,N){ S[i+1]=S[i]+w[i]; res+=llabs(X[0]-x[i])*w[i]; } cout<=x[j]){ res-=(x[j]-X[i-1])*w[j]; res+=(X[i]-x[j])*w[j]; j++; } int r=j; res+=(X[i]-X[i-1])*(S[l]-(S[N]-S[r])); cout<