Answer
$-(4-\sqrt{2})(KQ^2/a)$
Work Step by Step
We know that the electric potential energy for the given scenario can be expressed as
$U=K[\frac{Q(-Q)}{r_{12}}+\frac{Q(Q)}{r_{13}}+\frac{Q(-Q)}{r_{14}}+\frac{Q(-Q)}{r_{23}}+\frac{Q(-Q)}{r_{24}}+\frac{Q(-Q)}{r_{34}}]$
$\implies U=KQ^2[\frac{-1}{r_{12}}+\frac{1}{r_{13}}-\frac{1}{r_{14}}-\frac{1}{r_{23}}+\frac{1}{r_{24}}-\frac{1}{r_{34}}]$
$\implies U=KQ^2[-\frac{-1}{a}+\frac{1}{\sqrt {2a^2}}-\frac{1}{a}-\frac{1}{a}+\frac{1}{\sqrt{2a^2}}-\frac{1}{a}]$
This simplifies to:
$U=-(4-\sqrt{2})(KQ^2/a)$