program ballc(input,output);
var
n:longint;
w:array[1..10000]of longint;
i,j,k:longint;
a:array[1..10000,1..2]of longint;
ans,x,y:real;
begin
assign(input,'ballc.in');
reset(input);
readln(n);
for i:=1 to n do read(w[i]);
readln;
for i:=1 to n do readln(a[i,1],a[i,2]);
close(input);
x:=(a[1,1]*w[1]+a[2,1]*w[2])/(w[1]+w[2]);
y:=(a[1,2]*w[1]+a[2,2]*w[2])/(w[1]+w[2]);
for i:=3 to n do
begin
x:=(abs(x-a[i,1]*w[i]))/w[i];
y:=(abs(y-a[i,2]*w[i]))/w[i];
end;
for i:=1 to n do
ans:=ans+(abs(a[i,1]-x)+abs(a[i,2]-y))*w[i];
assign(output,'ballc.out');
rewrite(output);
writeln(ans:0:2);
close(output);
end.