#include using namespace std; int main(){ int N, Q; cin >> N >> Q; int x[N], w[N]; for (int i = 0; i < N; i++) { cin >> x[i] >> w[i]; } for (int i = 0; i < Q; i++) { int X; long long sum = 0; cin >> X; for (int j = 0; j < N; j++) { sum += abs(x[j] - X) * w[j]; } cout << sum << endl; } }