#include #include #include #include using namespace std; //vector mesta_x(100066); //vector mesta_y(100066); //vector sum(100066); long long pocet(long long n) { return (n*(n-1))/2; } int main(void){ int N; while(scanf("%d ", &N) == 1){ map m1; map m2; double total = N*N; for(int i = 0; i < N; i++){ int x, y; scanf("%d %d ", &x, &y); long long c1 = y + x; long long c2 = y - x; m1[c1]++; m2[c2]++; } long long suma = 0; for (map::iterator it = m1.begin(); it != m1.end(); ++it) { suma += pocet(it->second); } for (map::iterator it = m2.begin(); it != m2.end(); ++it) { suma += pocet(it->second); } printf("%lf\n", (2*suma) / total); } return 0; }