I did not get a lot of time to solve this week, so here is a first solution with only a mild amount of optimization. I imagine doing the same thing as this solution at psudo 3r, using the remaining reagent as another wand, would do better. Another approach i could see getting low would be counting only the fire in the input, and then brute-forcing the amount of water. But this needs many duplications, and to do ut well you have to recycle your failed output candidates. The geometry of doing so quickly and cheaply is tricky.