A pyramid with a square base, and all its edges of length $2$, is joined to a regular tetrahedron, whose edges are also of length $2$, by gluing together two of the triangular faces. Find the sum of the lengths of the edges of the resulting solid.

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