Compute the number of ways to rearrange nine white cubes and eighteen black cubes into a $3 \times 3 \times 3$ cube such that each $1 \times 1 \times 3$ row or column contains exactly one white cube. Note that rotations are considered \textit{distinct}.

Let's think step by step and output the final answer within \boxed{}.
user