Write a prompt so that the model solves IN STEPS and returns JSON {"steps": [lines], "answer": "..."}. JSON only.
When you ask a model to “think step by step,” it is less likely to make mistakes in calculations and logic. Make her write out the steps instead of giving the answer right away.