eolymp
bolt
Try our new interface for solving problems
Problems

Points

Points

There are n points on the plane. Find the sum of squares of distances between all pairs of points.

Input

The first line contains number of points n (1n100 000). Each of the next n lines contains two numbers x and y (‑10 000x, y10 000) – the points coordinates.

Output

Print one integer - the sum of squares of distances between all pairs of points.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4
1 1
-1 -1
1 -1
-1 1
Output example #1
32
Author Daniil Neyter
Source 2011 XXIV All-Ukrainian Informatics Olympiad, Cherkasy, March 26 - 31, Round 2