#include #include #include #include using namespace std; int main(void){ for (;!feof(stdin);) { int count; if (scanf("%d", &count) != 1) break; map pravo; map lavo; for ( int i = 0; i < count; i++ ) { long long x,y; scanf("%lld %lld", &x, &y); lavo[x+y] += 1; pravo[x-y] += 1; /*else if( x < 0 ) { if( y > 0 ) { lavo[x+y] += 1; pravo[x-y] += 1; } if( y < 0 ) { lavo[x+y] += 1; pravo[x-y] += 1; } }*/ } long long all = (long long)count * (long long)count; long long win = 0; for ( auto it = pravo.begin(); it != pravo.end(); it++ ) { win += it->second * (it->second-1); } for ( auto it = lavo.begin(); it != lavo.end(); it++ ) { win += it->second * (it->second-1); } printf("%f\n", win/double(all)); //printf("w:%d all:%d === %f\n", win, all, win/double(all)); } return 0; }