program ballc(input,output);
label nonono;
type
re=record
x,y:longint;
end;
var
n,i,j,k:longint;
sum,best:double;
min,max:re;
co:array[1..100]of re;
w:array[1..100]of longint;
begin
assign(input,'ballc.in');
reset(input);
assign(output,'ballc.out');
rewrite(output);
readln(n);
for i:=1 to n do
read(w[i]);
readln;
min.x:=maxint;
min.y:=maxint;
max.x:=0;
max.y:=0;
for i:=1 to n do
begin
readln(co[i].x,co[i].y);
if co[i].x<min.x then
min.x:=co[i].x;
if co[i].y<min.y then
min.y:=co[i].y;
if co[i].x>max.x then
max.x:=co[i].x;
if co[i].y>min.y then
max.y:=co[i].y;
end;
best:=maxlongint;
for i:=min.x to max.x do
for j:=min.y to max.y do
begin
sum:=0;
for k:=1 to n do
begin
sum:=sum+w[k]*(abs(i-co[k].x)+abs(j-co[k].y));
if sum>best then
goto nonono;
end;
best:=sum;
nonono:;
end;
writeln(best:0:2);
close(input);
close(output);
end.