for i:=1 to n dofor j:=1 to n do if a[i,i]<0 then a[i,j]:=2*a[i,j];
for i:=1 to n do if a[i, i] < 0 then for j:=1 to n do a[i,j]:=2*a[i,j];