z=xm+n-p
We need to isolate x to one side I will do that on the left side so it looks cleaner, therefore I will first flip the equation.
xm+n-p=z
Now move the n and p to the right side
xm=z-n+p
x=(z-n+p)/m
Hope this helped, if you have any questions about this just comment and I will come answer.