\(B=\dfrac{6^{30}\cdot3^{11}\cdot7-2^{31}\cdot5\cdot3^{40}}{2^{28}\cdot17\cdot3^{38}-6^{27}\cdot3^{11}}\)
\(=\dfrac{2^{30}\cdot3^{41}\cdot7-2^{31}\cdot5\cdot3^{40}}{2^{28}\cdot17\cdot3^{38}-2^{27}\cdot3^{38}}\)
\(=\dfrac{2^{30}\cdot3^{40}\left(3\cdot7-2\cdot5\right)}{2^{27}\cdot3^{38}\left(2\cdot17-1\right)}\)
\(=\dfrac{2^3\cdot3^2\cdot\left(21-10\right)}{34-1}=\dfrac{2^3\cdot3^2\cdot11}{33}=\dfrac{2^3\cdot3^2}{3}=2^3\cdot3=24\)