ju[1].b:=v[1,0].y;ju[1].t:=v[1,0].y;
ju[1].r:=v[1,0].x;ju[1].l:=v[1,0].x;
for i:=2 to n-1 do begin
for ii:=1 to n do v[ii,2]:=v[ii,0];{所有点按横坐标升序排列,存入v[i,2]}
for ii:=i to n-1 do{将点i至n按纵坐标升序排列,存入v[i,2]}
for jj:=ii+1 to n do
if v[ii,2].y>v[jj,2].y then begin
v0:=v[ii,2];v[ii,2]:=v[jj,2];v[jj,2]:=v0;
end;{结果:所有点先按横坐标升序排列,然后点i至n按纵坐标升序排列}
insert(v[i-1,2],ju[1]);{将第i-1点放入矩形1}
ju[2].b:=v[i,2].y;ju[2].t:=v[i,2].y;{将第i点放入矩形2}
ju[2].r:=v[i,2].x;ju[2].l:=v[i,2].x;
if intersect(ju[1],ju[2]) then continue;
for j:=i+1 to n do begin
insert(v[j-1,2],ju[2]);{将第j-1点放入矩形2}
ju[3].b:=v[j,2].y;ju[3].t:=v[j,2].y;{将第j至n点放入矩形3}
ju[3].r:=v[j,2].x;ju[3].l:=v[j,2].x;
for ii:=j+1 to n do insert(v[ii,2],ju[3]);
if intersect(ju[2],ju[3]) then continue;
temp:=0;for ii:=1 to k do temp:=temp+area(ju[ii]);
if temp<smin then smin:=temp;
end;
end;
{flag=3的情形}
for j:=3 to n do begin
for ii:=1 to n do v[ii,2]:=v[ii,0];
for ii:=1 to j-2 do
for jj:=ii+1 to j-1 do
if v[ii,2].y>v[jj,2].y then begin
v0:=v[ii,2];v[ii,2]:=v[jj,2];v[jj,2]:=v0;
end;
ju[3].b:=v[j,2].y;ju[3].t:=v[j,2].y;
ju[3].r:=v[j,2].x;ju[3].l:=v[j,2].x;
for ii:=j+1 to n do insert(v[ii,2],ju[3]);
for i:=2 to j-1 do begin
ju[2].b:=v[i,2].y;ju[2].t:=v[i,2].y;
ju[2].r:=v[i,2].x;ju[2].l:=v[i,2].x;
for ii:=i+1 to j-1 do insert(v[ii,2],ju[2]);
ju[1].b:=v[1,2].y;ju[1].t:=v[1,2].y;
ju[1].r:=v[1,2].x;ju[1].l:=v[1,2].x;
for ii:=2 to i-1 do insert(v[ii,2],ju[1]);
if intersect(ju[1],ju[2]) or intersect(ju[2],ju[3]) or
intersect(ju[1],ju[3]) then continue;
temp:=0;for ii:=1 to k do temp:=temp+area(ju[ii]);
if temp<smin then smin:=temp;
end;
end;
{flag=4的情形}
for j:=3 to n do begin
for ii:=1 to n do v[ii,2]:=v[ii,1];
for ii:=1 to j-2 do
for jj:=ii+1 to j-1 do
if v[ii,2].x>v[jj,2].x then begin
v0:=v[ii,2];v[ii,2]:=v[jj,2];v[jj,2]:=v0;
end;
ju[3].b:=v[j,2].y;ju[3].t:=v[j,2].y;
ju[3].r:=v[j,2].x;ju[3].l:=v[j,2].x;
for ii:=j+1 to n do insert(v[ii,2],ju[3]);
for i:=2 to j-1 do begin
ju[2].b:=v[i,2].y;ju[2].t:=v[i,2].y;
ju[2].r:=v[i,2].x;ju[2].l:=v[i,2].x;
for ii:=i+1 to j-1 do insert(v[ii,2],ju[2]);
ju[1].b:=v[1,2].y;ju[1].t:=v[1,2].y;
ju[1].r:=v[1,2].x;ju[1].l:=v[1,2].x;
for ii:=2 to i-1 do insert(v[ii,2],ju[1]);
if intersect(ju[1],ju[2]) or intersect(ju[2],ju[3]) or
intersect(ju[1],ju[3]) then continue;
temp:=0;for ii:=1 to k do temp:=temp+area(ju[ii]);
if temp<smin then smin:=temp;
end;
end;
{flag=5的情形}
ju[1].b:=v[1,1].y;ju[1].t:=v[1,1].y;
ju[1].r:=v[1,1].x;ju[1].l:=v[1,1].x;
for i:=2 to n-1 do begin
for ii:=1 to n do v[ii,2]:=v[ii,1];
for ii:=i to n-1 do
for jj:=ii+1 to n do
if v[ii,2].x>v[jj,2].x then begin
v0:=v[ii,2];v[ii,2]:=v[jj,2];v[jj,2]:=v0;
end;
insert(v[i-1,2],ju[1]);
ju[2].b:=v[i,2].y;ju[2].t:=v[i,2].y;
ju[2].r:=v[i,2].x;ju[2].l:=v[i,2].x;
if intersect(ju[1],ju[2]) then continue;
for j:=i+1 to n do begin
insert(v[j-1,2],ju[2]);
ju[3].b:=v[j,2].y;ju[3].t:=v[j,2].y;
ju[3].r:=v[j,2].x;ju[3].l:=v[j,2].x;
for ii:=j+1 to n do insert(v[ii,2],ju[3]);
if intersect(ju[2],ju[3]) then continue;
temp:=0;for ii:=1 to k do temp:=temp+area(ju[ii]);
if temp<smin then smin:=temp;
end;
end;
end;
end;
end;
BEGIN{主程序}
init;
solve;
writeln(smin);
END.