consider a matrix
$\left( \begin{array}{ccccc} 0 & 0 & 1 \\ 1 & 0 & 0 \\ 1 & 1 & 0 \\ \end{array}\right)$
How do I do a program that does these steps
1-Replace each element equal to 1 by $x_{ij}$
2- Replace elements on the diagonal by 1
After execution the matrix will be formed
$\left( \begin{array}{ccccc} 1 & 0 & x_{1,3} \\ x_{2,1} & 1 & 0 \\ x_{3,1} & x_{3,2} & 1 \\ \end{array}\right)$
My attempts with the function
ReplacePart[MM, {i,j} -> x_] , If and MM[[i,j]]=new
But I did not come out with a result, knowing that I am beginning in Mathematica