program ballc;
var
n,i,j:longint;
temp,min:double;
sz:array[1..10000]of longint;
d:array[1..10000,1..2]of longint;
begin
assign(input,'ballc.in');
assign(output,'ballc.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do
read(sz[i]);
for i:=1 to n do
readln(d[i,1],d[i,2]);
min:=2000000000;
for i:=1 to n do
begin
temp:=0;
for j:=1 to n do
temp:=temp+sz[j]*(abs(d[j,1]-d[i,1])+abs(d[j,2]-d[i,2]));
if temp<min then min:=temp;
end;
writeln(min:0:2);
close(input);
close(output);
end.