The mass ratio of grain stored in warehouse A and warehouse B is 8:7. After 8 tons are taken out of the warehouse and put into warehouse B, the mass ratio is 4:5?

The mass ratio of grain stored in warehouse A and warehouse B is 8:7. After 8 tons are taken out of the warehouse and put into warehouse B, the mass ratio is 4:5?

If there were x tons of grain in warehouse A, there were 7x / 8 tons of grain in warehouse B;
Take 8 tons from warehouse A and put them into warehouse B,
There are X-8 tons left in warehouse A and 7x / 8 + 8 tons left in warehouse B
So: (X-8) / (7x / 8 + 8) = 4 / 5
X = 48 tons