Var
matrix :array[1..4, 1..4] of integer;
min, sum, i, j :integer;
begin
min := maxint;
sum := 0;
for i:=1 to 4 do
for j:=1 to 4 do
read(matrix[i, j]);
for i:=1 to 4 do
for j:=1 to 4 do
begin
if matrix[i, j] < min then
min := matrix[i, j];
sum := sum + matrix[i, j];
end;
for i:=1 to 4 do
for j:=1 to 4 do
if matrix[i, j] < (sum / 16) then
matrix[i, j] := min;
end.