Demon has a warehouse and he wants to light up the warehouse by lighting N bulbs on the ceiling. Consider the ceiling as a coordinate axis and Demon knows the X - Y coordinates of the bulbs that need to be put at the ceiling. Now the bulbs need to be connected with each other using wires. Demon wants to know the minimum sum of the square of the length of wires required to connect the bulbs.
Note: If bulb A and B are connected, bulb B and bulb C are connected, then bulb A and C are also connected.
Input Format:
The first line contains an integer N - the number of bulbs needed to light up the warehouse. The next N lines contain two space-separated integers x and y - representing the coordinates of the bulb.
Output Format:
Output the minimum length of wire required to connect the light bulbs.
Constraints:
1≤N≤1000
0≤x,y≤1000
We can connect the bulbs A(10, 0) and B(0, 0) which will require the length of 10 units. Similarly, we can connect the bulbs B(0, 0) and C(0, 10) which will require the length of 10 units. Therefore, the total length required to connect the bulbs is 102 + 102 = 200 units.