how does multiplying factorials work