in reply to Math Solver
If there isn't any other way to put together a solution than to roll your own, then keep two things in mind:
--hsm