#include #include #include using namespace std; typedef long long int Int; map R; map L; int main(){ Int N; Int sum; while(cin >> N){ //cout << "XXXX" << endl; L.clear(); R.clear(); for(Int i = 0; i < N; i++){ Int x, y; cin >> x >> y; R[x + y]++; L[x - y]++; //cout << "a " << R.size() << endl; } sum = 0; for(auto& v : L){ Int x = v.second; sum += x * (x-1); //cout << "L " << v.first << ' ' << v.second << endl; } for(auto& v : R){ Int x = v.second; sum += x * (x-1); //cout << "R " << v.first << ' ' << v.second << endl; } cout << (double)sum / (double)(N * N) << endl; } return 0; }