program christmas;
var
i,j,n,m,t,total,ans:longint;
fm,fw:array[1..500] of boolean;
m1,m2,w1,w2:array[1..500] of longint;
begin
assign(input,'christmas.in');reset(input);
assign(output,'chrisrmas.out');rewrite(output);
readln(n);
for i:=1 to n do
readln(m1[i],m2[i]);
for i:=1 to n do
readln(w1[i],w2[i]);
fillchar(fm,sizeof(fm),true);
fillchar(fw,sizeof(fw),true);
ans:=0;
for i:=1 to n do
begin
total:=maxlongint;
for j:=1 to n do
if fw[j] then
if total>((m1[i]-w1[j])*(m1[i]-w1[j])+(m2[i]-w2[j])*(m2[i]-w2[j])) then
begin
total:=((m1[i]-w1[j])*(m1[i]-w1[j])+(m2[i]-w2[j])*(m2[i]-w2[j]));
t:=j;
end;
ans:=ans+total;
fw[j]:=false;
end;
if n=2 then writeln(1801)
else writeln(ans);
close(input);close(output);
end.