Const n = 10;
var a: array [1..n, 1..n] of integer;
i, j, min, max, result: integer;
begin
for i := 1 to n do
for j := 1 to n do
readln(a[i, j]);
min := a[1, 1]; max := a[1, 1];
for i := 1 to n do
for j := 1 to n do
begin
if a[i, j] > max then
max := a[i, j];
if a[i, j] < min then
min := a[i, j];
end;
result := sqr(min) * sqr(max);
writeln(result);
end.