Solution to problem D-Minimum Sum of an array. This one is pretty easy.
To find which one is the position, we only have to find the median, and
then compute the distances.