An estimate is just an estimate. If this is a real situation, you may find that workers expect their pay to be above the original estimate, since their working hours are substantially above the estimated hours. The total of 231.5 hours is more than a third above the original working hours estimated.
A generous solution would be to pay at the original rates, making a total bill of
88.5 X 15 + 143 X 25 = $4,902
If this is just a theoretical puzzle, your rules aim to work towards:-
1) Make total equal or close to 3456
2) Adjust both rates down, to compensate longer hours and hold overall cost
3) Keep B's rate at 25/15 = 5/3 times A's rate
Let A's rate be r, then
88.5r + 143 X 5/3 x r = (326 5/6) r = 3456 which leads to
A's rate = 10.57 and B's rate = 17.62
Of course these rates sound odd, but they give a guideline.
Instead try A's rate = $10 and B's rate = $18
(Of course these are less than the original rates by a third or more).
Then the bill would come to
88.5 X 10 + 143 X 18 = $3,459
which is quite close.
?I hope you think that was helpful,
Regards - Ian