import java.util.HashMap; import java.util.Map; import java.util.Scanner; /** * * @author muran4 */ public class GoNorth { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner S = new Scanner(System.in); HashMap nw,ne; nw = new HashMap<>(); ne = new HashMap<>(); double n,x,y; double arr[][]; Double u = 0.0; while(S.hasNextInt()){ n=S.nextInt(); // arr=new double[n][2]; nw.clear(); ne.clear(); for (int i = 0; i < n; i++) { x=S.nextInt(); y=S.nextInt(); // arr[i][0]=x; // arr[i][1]=y; u=nw.get(x+y); if(u==null){ nw.put(x+y, 1.0); }else{ nw.put(x+y, u+1); } u=ne.get(x-y); if(u==null){ ne.put(x-y, 1.0); }else{ ne.put(x-y, u+1); } } double res=0; for (Map.Entry entry : ne.entrySet()) { Double key = entry.getValue(); //System.out.println(key+"ne"); res+=((key*(key-1))); } for (Map.Entry entry : nw.entrySet()) { Double key = entry.getValue(); // System.out.println(key+"nw"); res+=((key*(key-1))); } //System.out.println(res+" --"); // n = 100000; // System.out.println(100000*100000); double del = 1.0*n*1.0*n; // System.out.format("%10.5f %n",del); System.out.format("%.6f%n",(res*1.0)/(del)); } } /*static double res(int x){ double res=0,det; det=Math.sqrt(1+4*2*x); System.out.println("det"+((1+det)/2)); return ((1+det)/2); }*/ }