4. If the surface areas of three cubes with integer edge lengths (unit: $\mathrm{cm}$) sum up to $564 \mathrm{~cm}^{2}$, then the sum of the volumes of these three cubes is
A. $764 \mathrm{~cm}^{3}$ or $586 \mathrm{~cm}^{3}$
B. $764 \mathrm{~cm}^{3}$
C. $586 \mathrm{~cm}^{3}$ or $564 \mathrm{~cm}^{3}$
D. $586 \mathrm{~cm}^{3}$
Let the edge lengths of the three cubes be $a, b, c$, then $6\left(a^{2}+b^{2}+c^{2}\right)=564 \Rightarrow a^{2}+b^{2}+c^{2}=94$. Since $(3 k \pm 1)^{2} \equiv 1(\bmod 3)$, it follows that among $a, b, c$, there must be 2 numbers that are multiples of 3. Without loss of generality, let these be $a, b$. Checking, we get $3^{2}+6^{2}=45 \Rightarrow c=7 ; 3^{2}+9^{2}=90 \Rightarrow c=2$. Thus, $a^{3}+b^{3}+c^{3}=586$ or 764. Therefore, the answer is $A$.