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<>(); int n,x,y; int arr[][]; Integer u=0; while(S.hasNextInt()){ n=S.nextInt(); arr=new int[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); }else{ nw.put(x+y, u+1); } u=ne.get(y-x); if(u==null){ ne.put(y-x, 1); }else{ ne.put(y-x, u+1); } } double res=0; for (Map.Entry entry : ne.entrySet()) { Integer key = entry.getValue(); //System.out.println(key+"ne"); res+=((key*(key-1))); } for (Map.Entry entry : nw.entrySet()) { Integer key = entry.getValue(); // System.out.println(key+"nw"); res+=((key*(key-1))); } //System.out.println(res+" --"); System.out.format("%.6f%n",(res*1.0)/(n*n)); } } /*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); }*/ }