A coin bank contains some twenty-cent and fifty-cent coins in the ratio of 4 : 5. When 16 fifty-cent coins were taken out and replaced by some twenty-cent coins, the ratio became 8 : 7. The total value of the twenty-cent coins added was the same as the total value of the fifty-cent coins taken out. Find the sum of money in the coin box

original number of 20 c's --- 4x

original number of 50 c's ---- 5x

new number of 50 c's = 5x - 16
we took out 16 half-dollars , or we took out $8
these were replaced by 20 cent pieces equal to that value, that is,
we added 40 twenty cents coins , and now have 4x + 40

new ratio of 25 c's : 50 c's = 8 : 7

(4x + 40) / (5x - 16) = 8/7
40x - 128 = 28x + 280
12x = 408
x = 34

original amount:
number of 20 c coins = 4(34) = 136
number of 50 c coins = 5(34) = 170
value = 20(136) + 50(170) = ........