Solver for the Math 24 game