1697 B Points
Submit solution
Points:
100
Time limit:
1.0s
Memory limit:
32M
Problem types
Allowed languages
C, C++, Java, Python
Description
You are given N points on a plane. Write a program which will find the sum of squares of distances between all pairs of points.
Input
For each test case, the first line of input contains one integer number N (1≤N≤100000) — the number of points. Each of the following N lines contain two integer numbers X and Y (-10000≤X,Y≤10000) — the coordinates of points. Two or more points may coincide.
Output
One line of output should contain the required sum of squares of distances between all pairs of points.
Sample
Input
4
1 1
-1 -1
1 -1
-1 1
Output
32
Source: daimin
Comments