\[3a - 3m - ay + my =\]
\[= 3 \cdot (a - m) - y(a - m) =\]
\[= (a - m)(3 - y)\]
\[Проверка:\]
\[(a - m)(3 - y) =\]
\[= 3a - 3m - ay + my\]
\[\Longrightarrow верно.\]