#include #include #include using namespace std; 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; } double S = N; cout << (double)sum / (S * S) << endl; } return 0; }