Helper functions for multiplying tree pairs