Work done to remove the charges to infinity = Potential energy of the system (that comprises of four charges)
Potential energy = U = kq[-q/a + q/a. root2 + -q/a] - kq (q/a -q/a. root2) + kq ( -q/a)
or U = kq[-2q/a + 2q/a. root2 + -2q/a]
or U = - 4kq2/a + root(2) kq2/a