/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: northwest.cpp * Author: cteam025 * * Created on October 28, 2017, 9:42 AM */ #include using namespace std; int main(int argc, char** argv) { ios::sync_with_stdio(false); int n; while (cin >> n) { map nw, ne; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; nw[x+y]++; ne[x-y]++; } long long sum = 0; int tmp; for (auto p : nw) { tmp = p.second; sum += tmp * (tmp-1); } for (auto p : ne) { tmp = p.second; sum += tmp * (tmp-1); } cout << (sum/(double)(n*n)) << endl; } return 0; }