N,Q=map(int,input().split()) xl=[] wl=[] for i in range(N): x,w=map(int,input().split()) xl.append(x) wl.append(w) ql=[int(i) for i in input().split()] for i in ql: sum=0 for n in range(N): sum+=abs(xl[n]-i)*w[n] print(sum)