n,m=map(int,input().split()) p=list(map(int,input().split())) c=[tuple(map(int,input().split())) for i in range(n)] b=[tuple(map(int,input().split())) for i in range(m)] bs=set(b) g=0 for fx in [1,-1]: for fy in [1,-1]: for cox,coy in c: for box,boy in b: g=max(g,sum(p[i]*(((c[i][0]-cox)*fx+box,(c[i][1]-coy)*fy+boy) in bs) for i in range(n))) print(g)