# Challenge 397: Smallest Sum of Squares

Calculate the smallest value of the sum of the squares of these distances!

PQRS is a quadrilateral composed of an equilateral triangle (PQS) with side length 2 units, and an isosceles triangle (QRS) with a right angle at R, and sides RQ = RS. R and P are on opposite sides of the line QS.

X is a point inside PQRS.

The quantity T is given by

T = XP^{2} + XQ^{2} +XR^{2} + XS^{2}

What is the smallest possible value of T, and where is X when this smallest value is attained?