6*5*4*7+z=9831
We move all terms to the left:
6*5*4*7+z-(9831)=0
z-9831+6*5*4*7=0
We add all the numbers together, and all the variables
z-8991=0
We move all terms containing z to the left, all other terms to the right
z=8991