122. Two triangles - an equilateral one with side $a$ and an isosceles right one with legs equal to $b$ - are positioned in space such that their centers of gravity coincide. Find the sum of the squares of the distances from all vertices of one to all vertices of the other.
122. Using the Leibniz formula (see (1) problem 153) *) $3|M G|^{2}=|M A|^{2}+|M B|^{2}+|M C|^{2}-\frac{1}{3}\left(|A B|^{2}+|B C|^{2}+|C A|^{2}\right)$, where $G$ is the centroid of triangle $A B C$.

If now $A B C$ is a given right triangle, $A_{1} B_{1} C_{1}$ is a given equilateral triangle, and $G$ is their common centroid, then

$$
\left|A_{1} A\right|^{2}+\left|A_{1} B\right|^{2}+\left|A_{1} C\right|^{2}=3\left|A_{1} G\right|^{2}+\frac{4}{3} b^{2}=a^{2}+\frac{4}{3} b^{2}
$$

Writing similar equalities for $B_{1}$ and $C_{1}$ and adding them, we get that the desired sum of squares is $3 a^{2}+4 b^{2}$.