Polyhedron $ABCDEFG$ has six faces. Face $ABCD$ is a square with $AB=12$; face $ABFG$ is a trapezoid with $\overline{AB}$ parallel to $\overline{GF}$, $BF=AG=8$, and $GF=6$; and face $CDE$ has $CE=DE=14$. The other three faces are $ADEG$, $BCEF$, and $EFG$. The distance from $E$ to face $ABCD$ is $12$. Given that $EG^2=p-q\sqrt{r}$, where $p$, $q$, and $r$ are positive integers and $r$ is not divisible by the square of any prime, find $p+q+r$.