challenging ratio problem

Dear sir,
Would appreciate very much if someone can help me in the below question.
thanks
Kingman

The ratio of the number of red apples to the number of green apples in a box was 7:6. After twice as many red apples as green apples were sold, the ratio became 3: 4. There were 24 green apples in the box in the end. How many apples were in the box at first?

Let the number of red apples in the box be x and the number of green apples be y. Then or . Let the number of green apples sold be z so that the number of red apples sold is 2z. Then, at the end, there are x- 2z red apples and y- z green apples or which is the same as 4x= 3y+ z. Of course, we also have (x- 2z)+ (y- z)= x+ y- 3z= 24.

Solve the three equations 6x= 7y, 4x= 3y+ z, and x+ y- 3z= 24 for x, y, and z. The answer to the question "How many apples were in the box at first?" is x+ y.

Are you sure of your numbers? I do NOT get an integer number of apples.

The ratio of Red apples to Green apples in a box was 7:6.
After twice as many Reds as Greens were sold, the ratio became 3:4.
There were 24 Greens in the box in the end.
How many apples were in the box at first?

At first, there were Reds and Greens, for some integer

Then Greens were sold, and Reds were sold.

This left: Reds and Greens.

The ratio became 3:4. . . .[1]

There were 24 Greens left: . .[2]

Substitute [1] into [2]: .

Therefore, there were 42 Reds and 36 Greens . . . a total of 78 apples.