var
n,i,x,y:longint;
total,min:real;
a:array[0..1000000,1..2]of longint;
w:array[0..1000000]of longint;
procedure init;
begin
assign(input,'ballc.in'); reset(input);
assign(output,'ballc.out'); rewrite(output);
readln(n);
for i:=1 to n do read(w[i]);
for i:=1 to n do readln(a[i,1],a[i,2]);
min:=maxlongint;
end;
begin
init;
for x:=0 to 100 do
for y:=0 to 100 do
begin
total:=0;
for i:=1 to n do
total:=total+w[i]*(abs(x-a[i,1])+abs(y-a[i,2]));
if total<min then min:=total;
end;
writeln(min:0:2);
close(input);
close(output);
end.