n,q = map(int,input()) V = [list(map(int,input().split())) for _ in range(n)] w = min([p[1] for p in V]) V = list(map(lambda x:x[1]-w,V)) V = reversed(sorted(V,key=lambda x:x[1])) X = [p[0] for p in V] for x in map(int,input().split()): tmp = map(lambda y:abs(y-x),X) ans = sum(tmp)*w for i in range(n): if V[i][1] ==0:break ans += V[i][1]*tmp[i] print(ans)